我使用的是214主题。我想在搜索结果页面上显示帖子的全部内容,而不仅仅是帖子的摘录。
请给我解决方案。
谢谢。
在content.php文件中,您将看到以下代码:
<?php if ( is_search() ) : ?>
<div class="entry-summary">
<?php the_excerpt(); ?>
</div><!-- .entry-summary -->
<?php else : ?>
<div class="entry-content">
<?php
/* translators: %s: Name of current post */
the_content( sprintf(
__( 'Continue reading %s <span class="meta-nav">→</span>', 'twentyfourteen' ),
the_title( '<span class="screen-reader-text">', '</span>', false )
) );
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; ?>
您需要在第三行显示_content而不是_except。您可以简单地用_content替换_except函数,但最终可能会出现不太美观的样式,因此您需要将其封装到适当的html中,例如:
<?php if ( is_search() ) : ?>
<div class="entry-content">
<?php the_content( sprintf(
__( 'Continue reading %s <span class="meta-nav">→</span>', 'twentyfourteen' ),
the_title( '<span class="screen-reader-text">', '</span>', false )
) ); ?>
</div><!-- .entry-summary -->
<?php else : ?>
<div class="entry-content">
<?php
/* translators: %s: Name of current post */
the_content( sprintf(
__( 'Continue reading %s <span class="meta-nav">→</span>', 'twentyfourteen' ),
the_title( '<span class="screen-reader-text">', '</span>', false )
) );
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; ?>