我正在制作一个Wordpress主题,由于某些原因,即使我有帖子,也表明我没有任何帖子。
<?php if(have_posts()){ ?>
<?php if ( is_home() && ! is_front_page() ) { ?>
<header>
<h1 class="page-title screen-reader-text"><?php single_post_title(); ?></h1>
</header>
<?php while ( have_posts() ){ the_post(); ?>
<?php
/*
* Include the Post-Format-specific template for the content.
* If you want to override this in a child theme, then include a file
* called content-___.php (where ___ is the Post Format name) and that will be used instead.
*/
get_template_part('template-parts/content', get_post_format()); ?>
<?php } ?>
<?php the_posts_navigation(); ?>
<?php }else{ ?>
<?php get_template_part( 'template-parts/content', 'none' ); ?>
<?php } ?>
我遇到调试问题,因为它显示了帖子。
答案 0 :(得分:0)
我检查了你的代码,看起来你在模板路径中犯了一个错误,它们应该是“模板部分/帖子/内容” - 你丢失了“post /”目录。