WordPress修改文章列表显示摘要
2014-09-11 00:18
537 查看
分类: Web前端 实验室2014-01-29
02:50 604人阅读 评论(0) 收藏 举报
用WordPress 3.8开的个人博客longt.me,在主页,分类页,搜索页时均为全文,文章多了效果不太好,查了一下官方文档,修改为首页显示摘要,具体方法如下:
进入外观-〉编辑,选择content.php,将下面代码:
<?php if ( is_search() ) : ?>
<div class="entry-summary">
<?php the_excerpt(); ?>
</div><!-- .entry-summary -->
<?php else : ?>
<div class="entry-content">
<?php
the_content( __( 'Continue reading <span class="meta-nav">→</span>', 'twentyfourteen' ) );
wp_link_pages( array(
'before' => '<div class="page-links"><span class="page-links-title">' . __( 'Pages:', 'twentyfourteen' ) . '</span>',
'after' => '</div>',
'link_before' => '<span>',
'link_after' => '</span>',
) );
?>
</div><!-- .entry-content -->
<?php endif; ?>
替换为:
<?php if ( is_single() ) : // Only display full content for Single page ?>
<div class="entry-content">
<?php
the_content( __( 'Continue reading <span class="meta-nav">→</span>', 'twentyfourteen' ) );
wp_link_pages( array(
'before' => '<div class="page-links"><span class="page-links-title">' . __( 'Pages:', 'twentyfourteen' ) . '</span>',
'after' => '</div>',
'link_before' => '<span>',
'link_after' => '</span>',
) );
?>
</div><!-- .entry-content -->
<?php else : ?>
<div class="entry-summary">
<?php the_excerpt(); ?>
</div><!-- .entry-summary -->
<?php endif; ?>
02:50 604人阅读 评论(0) 收藏 举报
用WordPress 3.8开的个人博客longt.me,在主页,分类页,搜索页时均为全文,文章多了效果不太好,查了一下官方文档,修改为首页显示摘要,具体方法如下:
进入外观-〉编辑,选择content.php,将下面代码:
<?php if ( is_search() ) : ?>
<div class="entry-summary">
<?php the_excerpt(); ?>
</div><!-- .entry-summary -->
<?php else : ?>
<div class="entry-content">
<?php
the_content( __( 'Continue reading <span class="meta-nav">→</span>', 'twentyfourteen' ) );
wp_link_pages( array(
'before' => '<div class="page-links"><span class="page-links-title">' . __( 'Pages:', 'twentyfourteen' ) . '</span>',
'after' => '</div>',
'link_before' => '<span>',
'link_after' => '</span>',
) );
?>
</div><!-- .entry-content -->
<?php endif; ?>
替换为:
<?php if ( is_single() ) : // Only display full content for Single page ?>
<div class="entry-content">
<?php
the_content( __( 'Continue reading <span class="meta-nav">→</span>', 'twentyfourteen' ) );
wp_link_pages( array(
'before' => '<div class="page-links"><span class="page-links-title">' . __( 'Pages:', 'twentyfourteen' ) . '</span>',
'after' => '</div>',
'link_before' => '<span>',
'link_after' => '</span>',
) );
?>
</div><!-- .entry-content -->
<?php else : ?>
<div class="entry-summary">
<?php the_excerpt(); ?>
</div><!-- .entry-summary -->
<?php endif; ?>
相关文章推荐
- WordPress修改文章列表显示摘要
- 让wordpress博客首页、分类页 显示文章标题列表或摘要
- 让wordpress博客首页、分类页 显示文章标题列表或摘要
- wordpress日志中的全部图片以缩略图的形式显示在文章摘要底部
- wp,wordpress博客怎样让首页的文章默认显示摘要
- laravel大型项目系列教程(四)之显示文章列表和用户修改文章
- WordPress 主题制作技巧之四 [ 在首页或分类页显示文章摘要 ]
- 控制wordpress文章摘要显示字数
- WordPress 显示文章摘要:the_excerpt标签函数
- Wordpress显示文章摘要
- WordPress在文章列表中显示评论
- Laravel大型项目系列教程(四)显示文章列表和用户修改文章
- wordpress 首页文章显示摘要
- WordPress显示最近评论的文章列表
- Laravel大型项目系列教程(四)显示文章列表和用户修改文章
- dedecms后台每页文章条数如何修改(“文档列表”每一页显示的文档条数)
- 让wordpress首页和分类列表页只显示文章标题列表
- wordpress显示最新的一篇文章的缩略图和摘要
- ECSHOP修改文章列表显示文章内容提要
- 让WordPress文章自动截断显示摘要