Some children's shoes often ask how to display the CMS homepage Focus Magic lights in the BLOG layout. The message cannot be described in the white. Now we will teach you to transplant the CMS homepage Focus Magic lights to the BLOG layout, don't feel dizzy when you see the long code. Just follow the steps below.
Effect
Tip: to edit and modify a template file, use notepad ++ or EmEditor text editing software, upload and overwrite the original file through FTP, or modify the template file in the Wordpress background appearance → edit, remember not to use the operating system comes with notepad to modify the Chinese template, otherwise it will change the template encoding, causing the topic dislocation or garbled (Chinese template encoding: UTF-8 without BOM ).
First, open blog. php and call the CMS homepage Focus Magic light code:
- <? Php include (TEMPLATEPATH. '/includes/slider. php');?>
- <? Php wp_reset_query ();?>
- <Div class = "clear12"> </div>
Add row 12th
- <! -- End: navigation -->
Below. Then, run the magic lamp JS Code:
- <Script type = "text/javascript" src = "<? Php bloginfo ('template _ directory');?> /Js/jquery. cycle. all. min. js "> </script>
Add the header. php template:
- <Script type = "text/javascript" src = "<? Php bloginfo ('template _ directory');?> /Js/muscript. js "> </script>
. Add the magic light style to the css.css in the HotNewspro \ CSS directory. Finally:
- /** Slideshow **/
- # Slideshow {
- Position: relative;
- Background: # fff;
- Width: 710px;
- Height: 248px;
- Padding: 10px;
- Border: 1px solid # ccc;
- }
- . Slideshow {
- Width: 710px;
- Height: 248px;
- Overflow: hidden;
- }
- . Featured_post {
- Width: 708px;
- Height: 248px;
- Overflow: hidden;
- }
- . Slider_image,. slider_image img {
- Float: left;
- Width: 400px;
- Height: 248px;
- }
- . Slider_post {
- Float: rightright;
- Width: 280px;
- Padding-right: 10px;
- }
- . Slider_post p {
- Font-size: 13px;
- Text-indent: 2em;
- Margin-top: 5px;
- Line-height: 24px;
- }
- # Slider_nav {
- Position: absolute;
- Z-index: 999;
- Margin: 210px 0 0 270px;
- }
- # Slider_nav {
- Background: url (../images/slider_nav.png );
- Float: left;
- Line-height: 24px;
- Padding: 0 8px 0 8px;
- Color: # ebeb;
- Text-shadow: none;
- }
- # Slider_nav a. activeSlide {color: # f99356 ;}
- # Featured_tag {
- Background: url (../images/featured.png );
- Position: absolute;
- Width: 21px;
- Height: 79px;
- Left: 0px;
- Top: 20px;
- Z-index: 999;
- }
- . News {
- Position: absolute;
- Width: 51px;
- Height: 51px;
- Rightright:-3px;
- Top:-3px;
- Z-index: 10;
- }
- . Cat_name {
- Position: absolute;
- Line-height: 20px;
- Rightright: 100px;
- Top:-1px;
- Text-align: center;
- Padding: 0 20px 0 20px;
- Border: 1px solid # ccc;
- }
- # Map_h {
- Width: 980px;
- }
- . Time_h {
- Float: left;
- Margin: 0 0 0 10px;
- }
- . Tag_t {
- Float: rightright;
- Width: 750px;
- Height: 23px;
- Overflow: hidden;
- }
- . Tag_t {
- Padding: 0 0 0 10px;
- Font-weight: bold;
- Text-shadow: 0px 1px 0px # fff;
- }
Finally, refresh the page to see if the slides are normally displayed in the BLOG layout.
Similarly, you can add the slides to the blog_page.php independent blog template.
Author: zhiyubird