首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >为什么博客帖子没有显示出来?

为什么博客帖子没有显示出来?
EN

WordPress Development用户
提问于 2016-12-10 12:32:48
回答 1查看 32关注 0票数 0

我创建了一个名为blog的模板页面。现在我做了博客查询。但博客文章并没有在输出上显示出来。问题是什么?守则如下:

代码语言:javascript
复制
<?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(); ?>
EN

回答 1

WordPress Development用户

发布于 2016-12-10 12:55:10

我有我的答案。它应该是类似于

代码语言:javascript
复制
<?php query_posts ('post_type=post&post_status = publish&posts_per_page10&paged='. get_query_var('paged')); ?> 
票数 0
EN
页面原文内容由WordPress Development提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://wordpress.stackexchange.com/questions/248867

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档