我创建了一个名为blog的模板页面。现在我做了博客查询。但博客文章并没有在输出上显示出来。问题是什么?守则如下:
<?php
/*
Template Name: Blog
*/
?>
<?php get_header(); ?>
<div class="blog-post">
<?php if(have_posts()) : ?>
<?php while(have_posts()) : the_post(); ?>
<h2> <?php the_title(); ?> </h2>
<?php the_content(); ?>
<?php endwhile; ?>
<?php else : ?>
<?php get_template_part('404') ?>
<?php endif; ?>
</div>
<!-- Start Sidebar Widgets -->
<div class="five columns sidebar bottom-3">
<!-- Search Widget -->
<div class="widget search">
<h3 class="title bottom-1">Search</h3><!-- Title Widget -->
<?php get_search_form( ); ?>
</div>
<!-- End -->
<!-- Categories Widget -->
<div class="widget categories">
<?php if ( ! dynamic_sidebar( 'sidebar-1' ) ) : ?>
<?php endif; ?>
</div>
<!-- End -->
<div class="widget categories">
<?php if ( ! dynamic_sidebar( 'sidebar-2' ) ) : ?>
<?php endif; ?>
</div>
<!-- End -->
<!-- Most Posts -->
<!-- End -->
</div><!-- End Sidebar Widgets -->
<div class="clearfix"></div>
</div><!-- <<< End Container >>> -->
<?php get_footer(); ?>发布于 2016-12-10 12:55:10
我有我的答案。它应该是类似于
<?php query_posts ('post_type=post&post_status = publish&posts_per_page10&paged='. get_query_var('paged')); ?> https://wordpress.stackexchange.com/questions/248867
复制相似问题