WordPress.org

Ready to get started?Download WordPress

Forums

PageNavi won't show om templatepage (1 post)

  1. eonlova
    Member
    Posted 1 year ago #

    Having problems to show the PageNavi-pager on a Template-page. I can force it to show by checking the box "Always Show Page Navigation", but will only get one page. Think there is something wrong with my query, but not sure what. Here is the code I'm running:

    <?php
    /**
    * Lists all post in Tax(Case)
    */
    $args = array(
    'post_type' => 'post',
    'posts_per_page' => 1,
    'orderby' => 'date',
    'order' => Desc
    );

    $blog_loop = new WP_Query( $args );

    if($blog_loop->have_posts() ) :
    while ( $blog_loop->have_posts() ) : $blog_loop->the_post(); ?>
    <aside id="box" class="blog first">
    <?php // first loop will show only first post ?>
    </aside>
    <?php
    endwhile;
    endif;

    wp_reset_postdata(); ?>

    </div><!-- .row-fluid -->

    <footer class="row-fluid">
    <section class="span12 more-posts">
    <?php
    /**
    * Lists all post in Tax(Case)
    */
    $paged = (get_query_var('page')) ? get_query_var('page') : 1;

    $args = array(
    'post_type' => 'post',
    'orderby' => 'date',
    'post_status' => 'publish',
    'paged' => $paged
    );
    $blog_loop = new WP_Query( $args );

    if($blog_loop->have_posts() ) :
    while ( $blog_loop->have_posts() ) : $blog_loop->the_post(); ?>

    <aside>
    <?php // second loop with the rest of my posts ?>

    </aside>
    <?php endwhile; ?>
    <?php if(function_exists('wp_pagenavi'))
    { // if PageNavi is activated ?>
    <?php wp_pagenavi(); // Use PageNavi ?>
    <?php
    }
    else
    { // Otherwise, use traditional Navigation ?>

    <div class="nav-previous">
    <!-- next_post_link -->
    </div>
    <div class="nav-next">
    <!-- previous_post_link -->
    </div><?php

    } ?>
    <?php endif; ?>
    <?php wp_reset_postdata(); ?>

    Why won't the pager show up?
    Someone that can help me?

Topic Closed

This topic has been closed to new replies.

About this Topic