简体   繁体   English

注释关闭时,WordPress不会显示摘录

[英]Wordpress doesn't show excerpt when comments are off

i have a problem with my wordpress theme. 我的wordpress主题有问题。 It works, but when i would like to turn the comments off, it doesn't show me the excerpt. 它有效,但是当我想关闭评论时,它不会显示摘要。

The first picture shows how it look like when comments are allowed, the second picture shows it when comments are not allowed. 第一张图片显示了允许注释时的外观,第二张图片显示了不允许注释时的外观。

Comments allowed 允许评论

Comments off 评论关闭

Here is the code snippet from content.php page: 这是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>

You accidentally deleted an <?php endif;?> 您不小心删除了<?php endif;?>

<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>

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM