0
我做了我的第一个主题,它非常适合编辑更新页面等,但不会显示任何帖子。WordPress的“循环”不显示在我的主题的博客文章
我已将“循环”放入模板页面(从第21个主题复制而来),因为我只希望帖子出现在该页面上。我已将博文设置为显示在此页面上(来自设置页面),但仍然没有显示。
这是我的模板页面显示博客文章的代码。
任何想法有什么不对?
<?php
/**
* Template Name: blog
*
* Full width page template with no sidebar.
*
* @package Myfirsttheme
* @subpackage Template
*/
get_header(); ?>
<?php if (have_posts()) : ?>
<?php /* Start the Loop */ ?>
<?php while (have_posts()) : the_post(); ?>
<?php get_template_part('content', get_post_format()); ?>
<?php endwhile; ?>
<?php else : ?>
<article id="post-0" class="post no-results not-found">
<div class="entry-content">
<p><?php _e('Apologies, but no results were found. Perhaps searching will help find a related post.', 'twentytwelve'); ?></p>
<?php get_search_form(); ?>
</div><!-- .entry-content -->
<?php endif; // end current_user_can() check ?>
</article><!-- #post-0 -->
<?php endif; // end have_posts() check ?>
</div><!-- #content -->
</div><!-- #primary -->
<?php get_footer(); ?>
你分配此模板的page..Go页面,并设置默认模板中列出的项目选择... – 2013-04-28 03:09:32
2 ENDIF一个如果?? !!! – 2013-04-28 04:22:08
如果这是你的整个代码,你应该得到空白页面,因为你有<?php endif; //结束current_user_can()检查?>但没有,如果语句。 – user850010 2013-04-28 09:54:35