我只想加载没有标题、日期、评论等信息的帖子内容。有没有办法只抢帖子?
<?php if ( have_posts() ) : ?>
<?php while ( have_posts() ) : the_post(); ?>
<?php get_template_part( 'content', get_post_format() ); ?>
<?php endwhile; ?>
<?php endif; ?>
只需替换:
<?php get_template_part( 'content', get_post_format() ); ?>
跟:
<?php the_content(); ?>
前者正在寻找类似内容状态.php或内容旁白的东西.php或者最有可能的是,在普通的旧"帖子"的情况下,内容.php在你的主题根中。
你可以替换
<?php get_template_part( 'content', get_post_format() ); ?>
跟
<?php get_template_part( 'content', 'myformat' ); ?>
,然后编辑名称为 content-myformat.php
的content-page.php
的副本,您可以在其中删除the_title()
行。