当评论关闭时,Wordpress不会显示摘录

时间:2016-09-24 14:31:56

标签: php wordpress wordpress-theming

我的wordpress主题有问题。它有效,但是当我想关闭评论时,它并没有向我展示摘录。

第一张图片显示允许评论时的样子,第二张图片显示不允许评论时。

Comments allowed

Comments off

以下是来自content.php页面的代码段:

<article id="post-<?php the_ID(); ?>" <?php post_class(); ?>>
<header class="entry-header">
<div class="entry-header-title">


    <?php if ( is_single() ) : ?>
    <h1 class="entry-title"><?php the_title(); ?></h1>
    <?php else : ?>
    <h1 class="entry-title">
        <a href="<?php the_permalink(); ?>" rel="bookmark"><?php the_title(); ?></a>
    </h1>
    <?php endif; // is_single() ?>

    <span class="entry-meta-date">
        <?php twentythirteen_entry_date(); ?>
    <span>|</span>


    <?php if ( comments_open() && ! is_single() ) : ?>
        <span class="entry-comments" >
                    <?php comments_popup_link( '<span class="leave-reply">' . __( 'Leave a Reply', 'twentythirteen' ) . '</span>', __( '1 Comment', 'twentythirteen' ), __( '% Comments', 'twentythirteen' ) ); ?>
        </span><!-- .entry-comments -->

    </span><!-- .entry-meta -->

    <?php if ( has_post_thumbnail() && ! post_password_required() ) : ?>
        <div class="entry-thumbnail">
            <?php the_post_thumbnail(); ?>
        </div>
    <?php endif; ?>


</div>


</header><!-- .entry-header -->

<?php if ( is_search() ) : // Only display Excerpts for 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">&rarr;</span>', 'twentythirteen' ) ); ?>
    <?php wp_link_pages( array( 'before' => '<div class="page-links"><div class="page-links-title">' . __( 'Pages:', 'twentythirteen' ) . '</div>', 'after' => '</div>', 'link_before' => '<div>', 'link_after' => '</div>' ) ); ?>
</div><!-- .entry-content -->

<?php endif; ?>

<footer class="entry-meta">



        <?php endif; // comments_open() ?>

        <div class="entry-labels">
        <?php twentythirteen_entry_meta(); ?>
        </div>

        <div class="entry-share">
            <?php if( function_exists('ADDTOANY_SHARE_SAVE_KIT') ) { ADDTOANY_SHARE_SAVE_KIT(); } ?>
        </div>




        <div class=".post-spacer">
        </div>

</footer><!-- .entry-meta -->
</article><!-- #post -->

<div class="linkwithin_div"></div>

1 个答案:

答案 0 :(得分:0)

您不小心删除了<article id="post-<?php the_ID(); ?>" <?php post_class(); ?>> <header class="entry-header"> <div class="entry-header-title"> <?php if ( is_single() ) : ?> <h1 class="entry-title"><?php the_title(); ?></h1> <?php else : ?> <h1 class="entry-title"> <a href="<?php the_permalink(); ?>" rel="bookmark"><?php the_title(); ?></a> </h1> <?php endif; // is_single() ?> <span class="entry-meta-date"> <?php twentythirteen_entry_date(); ?> <span>|</span> <?php if ( comments_open() && ! is_single() ) : ?> <span class="entry-comments" > <?php comments_popup_link( '<span class="leave-reply">' . __( 'Leave a Reply', 'twentythirteen' ) . '</span>', __( '1 Comment', 'twentythirteen' ), __( '% Comments', 'twentythirteen' ) ); ?> </span><!-- .entry-comments --> </span><!-- .entry-meta --> //THIS ONE <?php endif; // comments_open() ?> <?php if ( has_post_thumbnail() && ! post_password_required() ) : ?> <div class="entry-thumbnail"> <?php the_post_thumbnail(); ?> </div> <?php endif; ?> </div> </header><!-- .entry-header --> <?php if ( is_search() ) : // Only display Excerpts for 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">&rarr;</span>', 'twentythirteen' ) ); ?> <?php wp_link_pages( array( 'before' => '<div class="page-links"><div class="page-links-title">' . __( 'Pages:', 'twentythirteen' ) . '</div>', 'after' => '</div>', 'link_before' => '<div>', 'link_after' => '</div>' ) ); ?> </div><!-- .entry-content --> <?php endif; ?> <footer class="entry-meta"> <div class="entry-labels"> <?php twentythirteen_entry_meta(); ?> </div> <div class="entry-share"> <?php if( function_exists('ADDTOANY_SHARE_SAVE_KIT') ) { ADDTOANY_SHARE_SAVE_KIT(); } ?> </div> <div class=".post-spacer"> </div>

{{1}}