美文网首页
Wordpress首页显示文章摘要(主题Twenty Sixte

Wordpress首页显示文章摘要(主题Twenty Sixte

作者: LANVNAL | 来源:发表于2020-02-11 16:48 被阅读0次

    在WordPress系统中,默认的首页和目录页使用的书全文输出,这对于文章内容较长的博客来说很不方面,下面方法可以简单的实现在WordPress首页和目录页显示摘要而非全文。

    去主题编辑器,修改该文件代码:template-parts/content.php

    25行:

            <?php
                the_content(
                    sprintf(
                        // translators: %s: Post title. 
                        __( 'Continue reading<span class="screen-reader-text"> "%s"</span>', 'twentysixteen' ),
                        get_the_title()
                    )
                );
    

    注释掉,更改为:

                if(!is_single()) {
                    the_excerpt();
                    } else {
                    the_content(__('(more…)'));
                    } 
    

    相关文章

      网友评论

          本文标题:Wordpress首页显示文章摘要(主题Twenty Sixte

          本文链接:https://www.haomeiwen.com/subject/afbxfhtx.html