0

I have created a template page called blog. now i have made blog query. but the blog posts is not showing in output. what can be the problem is? the code is below:

<?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(); ?>
1
  • A few questions: What version of WP? Did you copy and rename index.php? What is the file name (tpl_blog.php / etc)? Where is said file located in theme folders? Commented Dec 10, 2016 at 12:48

1 Answer 1

0

i have got my answer. it should be query like

<?php query_posts ('post_type=post&post_status = publish&posts_per_page10&paged='. get_query_var('paged')); ?> 

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.