文章页删除侧栏,样式改为全屏阅读,删除海报生成功能
修改single.php中的代码
$class = $sidebar ? 'main' : 'main main-full'; 为 'main main-full';
删除
<?php if( $sidebar ){ ?>
<aside class="sidebar">
<?php get_sidebar();?>
</aside>
<?php } ?>
<div class="entry-bar">
<div class="entry-bar-inner clearfix">
<?php if($show_author) { ?>
<div class="author pull-left">
<?php
$display_name = get_avatar( $author, 60, '', $author_name) . '<span class="author-name">' . $author_name . '</span>';
$display_name = apply_filters('wpcom_user_display_name', $display_name, $author, 'full');
?>
<a data-user="<?php echo $author;?>" target="_blank" href="<?php echo $author_url; ?>" class="avatar j-user-card">
<?php echo $display_name; ?>
</a>
</div>
<?php } ?>
<div class="info <?php echo $show_author?'pull-right':'text-center';?>">
<div class="info-item meta">
<?php if(isset($options['member_enable']) && $options['member_enable']=='1'){ ?>
<a class="meta-item j-heart" href="javascript:;" data-id="<?php the_ID(); ?>"><?php WPCOM::icon('heart'); ?> <span class="data"><?php $favorites = get_post_meta($post->ID, 'wpcom_favorites', true); echo $favorites?$favorites:0;?></span></a><?php } ?>
<?php if ( isset($options['comments_open']) && $options['comments_open']=='1' ) { ?><a class="meta-item" href="#comments"><?php WPCOM::icon('comments'); ?> <span class="data"><?php echo get_comments_number();?></span></a><?php } ?>
<?php if($dashang_display==0 && isset($options['dashang_1_img']) && ($options['dashang_1_img'] || $options['dashang_2_img'])){ ?>
<a class="meta-item dashang" href="javascript:;">
<i class="icon-dashang"></i>
<span class="dashang-img<?php if($options['dashang_1_img']&&$options['dashang_2_img']){echo ' dashang-img2';}?>">
<?php if($options['dashang_1_img']){ ?>
<span>
<img src="<?php echo esc_url($options['dashang_1_img'])?>" alt="<?php echo esc_attr($options['dashang_1_title'])?>"/>
<?php echo $options['dashang_1_title'];?>
</span>
<?php } ?>
<?php if($options['dashang_2_img']){ ?>
<span>
<img src="<?php echo esc_url($options['dashang_2_img'])?>" alt="<?php echo esc_attr($options['dashang_2_title'])?>"/>
<?php echo $options['dashang_2_title'];?>
</span>
<?php } ?>
</span>
</a>
<?php } ?>
</div>
<div class="info-item share">
<a class="meta-item mobile j-mobile-share" href="javascript:;" data-id="<?php the_ID();?>" data-qrcode="<?php the_permalink();?>"><?php WPCOM::icon('share-alt'); ?> <?php _e('Generate poster', 'wpcom');?></a>
<?php if(isset($options['post_shares'])){ if($options['post_shares']){ foreach ($options['post_shares'] as $share){ ?>
<a class="meta-item <?php echo $share;?>" data-share="<?php echo $share;?>" target="_blank" rel="nofollow" href="#">
<?php WPCOM::icon($share); ?>
</a>
<?php } } }else{ ?>
<a class="meta-item wechat" data-share="wechat" href="#"><?php WPCOM::icon('wechat'); ?></a>
<a class="meta-item weibo" data-share="weibo" target="_blank" rel="nofollow" href="#"><?php WPCOM::icon('weibo'); ?></a>
<a class="meta-item qq" data-share="qq" target="_blank" rel="nofollow" href="#"><?php WPCOM::icon('qq'); ?></a>
<?php } ?>
</div>
<div class="info-item act">
<a href="javascript:;" id="j-reading"><?php WPCOM::icon('file-text'); ?></a>
</div>
</div>
</div>
</div>
分类缩略图外链
在fuction.php中添加
//列表图片2
function post_thumbnail_list2($width=400) {
global $post;
$title = $post->post_title;
if (get_option('template')=='justnews'){
if ( has_post_thumbnail() ) {
$timthumb_src = wp_get_attachment_image_src(get_post_thumbnail_id($post->ID) , 'full');
$post_timthumb = '<img src="' . get_bloginfo("template_url") . '/timthumb.php?src=' . $timthumb_src[0] . '&w=' . $width . '&zc=1;a=t" alt="' . $title . '" />';
echo $post_timthumb;
} else {
$content = $post->post_content;
preg_match_all('/<img.*?(?: |\\t|\\r|\\n)?src=[\'"]?(.+?)[\'"]?(?:(?: |\\t|\\r|\\n)+.*?)?>/sim', $content, $strResult, PREG_PATTERN_ORDER);
$n = count($strResult[1]);
if($n > 0){
echo '<img src="' . get_bloginfo("template_url").'/timthumb.php?src=' . $strResult[1][0] . '&h=600&w=' . $width . '&zc=1" alt="'.$title.'" class="attachment-post-thumbnail size-post-thumbnail wp-post-image j-lazy" />';
}
}
}else{
if ( has_post_thumbnail() ) {
the_post_thumbnail();
} else {
$content = $post->post_content;
preg_match_all('/<img.*?(?: |\\t|\\r|\\n)?src=[\'"]?(.+?)[\'"]?(?:(?: |\\t|\\r|\\n)+.*?)?>/sim', $content, $strResult, PREG_PATTERN_ORDER);
$n = count($strResult[1]);
if($n > 0){
echo '<img src="'.$strResult[1][0].'" width="'. $width .'" height="auto" alt="'.$title.'"/>';
}
}
}
}
把loop-image.php
<?php the_post_thumbnail();?> 改成 <?php post_thumbnail_list2();?>
把category.php
$tpl = get_term_meta( $term_id, 'wpcom_tpl', true ); 改成 $tpl = 'image'; $sidebar = get_term_meta( $term_id, 'wpcom_sidebar', true ); 改成 $sidebar = '0';
鲁树人站长志
