由于个人需求原因,需要对萨龙主题mnews主题首页进行一些版面的改造,以满足自己的需求;在这里记录一下修改过程;
找到主题文件夹里面的:/wp-content/themes/mnews/content/home-new.php当前文件,然后使用notepad++类软件打开,删除其中的第9-40行代码,具体如下:
<section class="content_left"> <?php if($cate_arr){ echo do_shortcode('[ajax_filter_posts_mt per_page='.get_option('posts_per_page').' pager='.$pager.' include='.$cate.">'); }else{ ?> <!--标题--> <section class="home_title"> <section class="title"> <h3><img src="/images/head.gif" style="margin:0px;float:left;"><?php echo $salong['home_new_title">; ?></h3> <?php if(get_today_post_count() && $salong['switch_today_post_count">){ ?> <span><?php echo sprintf(__('今日更新<b>%s</b>篇','salong'),get_today_post_count()); ?></span> <?php } ?> </section> <section class="button"> <a href="<?php echo get_page_link(get_page_id_from_template('template-post.php')); ?>" title="<?php _e( '查看更多', 'salong' ); ?>" <?php echo new_open_link(); ?>><?php echo _e('更多','salong').svg_more(); ?></a> </section> </section> <!--标题end--> <ul class="ajaxposts"> <?php $paged=( get_query_var( 'paged' ) ) ? get_query_var( 'paged' ) : 1;$args=array( 'post_type'=> 'post','ignore_sticky_posts' => 1,'category__not_in'=> $salong[ 'exclude_new_cat">,'paged' => $paged );$temp_wp_query = $wp_query;$wp_query = null; $wp_query = new WP_Query( $args ); $i = 0; if ( $wp_query->have_posts() ) : while ( $wp_query->have_posts() ) : $wp_query->the_post(); if($i==$salong['ad_home_new_flow_show_count">){ salong_ad('home_new_flow'); }$i++;//输出广告 ?> <li class="ajaxpost"> <?php get_template_part( 'content/list', 'post'); ?> </li> <?php endwhile;endif; ?> <!-- 分页 --> <?php posts_pagination(); ?> <?php wp_reset_query(); $wp_query=null; $wp_query=$temp_wp_query;?> </ul> <?php } ?> </section>
第一、在/wp-content/themes/mnews/stylesheets/main.css里面搜索:.content .sidebar,将其中的/*width: 360px; */给予注释或者删除;
第二、同样在main.css中搜索.sidebar_widget样式,然后将原来的样式:
overflow: hidden; margin-bottom: 24px; background: #fff; border: 1px #e5e5e5 solid;
改为如下样式:
overflow: hidden; margin-bottom: 24px; background: #fff; border: 1px #e5e5e5 solid; float: left; width: 33.1%; margin-right: 0.15%; height: 525px;
截止到此时代码就侯完毕了;
修改之前效果如下图:
修改之后的效果: