Everything works fine other than the pagination. I have even tried with my own pagination method which works fine on Index page and Archive page but not in this template

 * Template Name: Flowers
<article id="post-<?php the_ID(); ?>" <?php post_class(); ?>>
        echo '<hr><h2 class="post_title">Browsing : Flowers</h2><hr>';
    <?php  while (have_posts()) : the_post(); ?>
        <div class="content">
            <?php the_content();?>
    <?php endwhile; ?>
    <?php $paged = (get_query_var('paged')) ? get_query_var('paged') : 1;  ?>
    <?php  wp_reset_query(); ?>
    $query = new WP_Query( array( 
        'category_name' => 'flowers',
        'order'         => 'asc',
        'post_type'     => 'post',
        'post_status'   => 'publish',
        'paged'         => $paged
    if ($query->have_posts()) {
        while ($query->have_posts()) : $query->the_post(); ?>
            <div class="post clearfix">
                echo '<div class="featured-image">';
                echo '<a href="'. get_permalink() .'">';
                echo the_post_thumbnail('small-thumb');
                echo '</a>';
                echo '</div>';
                <div class="post-content">
                    <header class="entry-header">
                        <?php echo '<h2 class="entry-title"><a href="'. get_permalink() .'">'.ucfirst(get_the_title()).'</a></h2>'; ?>
                    </header><!-- .entry-header -->
                        echo trunc(get_the_content(),25);
                        echo '<div class="continue-reading">';
                        echo '<a href="'. get_permalink() .'" title="'.__('Continue Reading', 'little-sparrow').get_the_title().'"rel="bookmark">Continue Reading <i class="fa fa-chevron-circle-right"></i></a>';
                        echo '</div>';

        <?php endwhile;

</article><!-- #post-## -->
  • where do you want to put the pagination ?
    – mmm
    Jun 29, 2015 at 10:45
  • Sorry my code is all broken but I want the pagination to appear at the end of the loop
    – Puni
    Jun 29, 2015 at 10:47
  • Just a tip, if you post code in the editor, highlight your code and click on the {} sign above the editor. This will add your code in a code block. Alternatively, indent your each line of code with 4 spaces Jun 29, 2015 at 10:53
  • Pieter Goosen and mmm thank you very much I just joined the community yesterday.
    – Puni
    Jun 29, 2015 at 10:55
  • possible duplicate of How to use the_posts_navigation for wp_query and get_posts? Jun 29, 2015 at 11:01


Your Answer

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

Browse other questions tagged or ask your own question.