我想加载帖子内容,但没有标题,日期,评论等信息.有没有办法只抓住这个帖子?
<?php if ( have_posts() ) : ?>
<?php while ( have_posts() ) : the_post(); ?>
<?php get_template_part( 'content', get_post_format() ); ?>
<?php endwhile; ?>
<?php endif; ?>
Run Code Online (Sandbox Code Playgroud)
小智 8
你可以替换
<?php get_template_part( 'content', get_post_format() ); ?>
Run Code Online (Sandbox Code Playgroud)
同
<?php get_template_part( 'content', 'myformat' ); ?>
Run Code Online (Sandbox Code Playgroud)
并编辑content-page.php带有名称的副本content-myformat.php,您可以在其中删除the_title()行.
简单地替换:
<?php get_template_part( 'content', get_post_format() ); ?>
Run Code Online (Sandbox Code Playgroud)
附:
<?php the_content(); ?>
Run Code Online (Sandbox Code Playgroud)
前者正在寻找类似content-status.php或content-aside.php的内容,或者很可能是在主题根目录中使用简单的旧帖子" content.php".