WordPress.org

Ready to get started?Download WordPress

Forums

WP-PageNavi
also displaying only the first page (8 posts)

  1. killerbrain
    Member
    Posted 2 years ago #

    <div id="inner-main-content">
    <?php while (have_posts()) : the_post(); ?>
    <h1><?php the_title(); ?></h1>
    <?php endwhile;?>
    <? $communityservice = "community-service"; ?>
    <?php query_posts('category_name='.$communityservice.'&posts_per_page=1'); ?>
    <?php while (have_posts()) : the_post(); ?>
    <div class="news-container">
    <?php the_post_thumbnail('updates-thumb'); ?>
    <div class="news-intro" style="float:left; margin-left:10px; width:350px;">
    " class="link-title"><?php the_title(); ?>
    <p style="font-size:11px; margin:2px 0px 2px 0px;"><i>Posted <?php echo get_the_date(); ?> at <?php echo get_the_time(); ?></i></p>
    <p style="line-height:17px;">
    <?php short_excerpt(180) ?>
    " class="read-more">read more <span class="meta-nav">→</span>
    </p>

    </div>
    </div>
    <div class="clear"></div>

    <hr>
    <?php endwhile;?>
    <?php wp_pagenavi(); ?>
    </div>

    http://wordpress.org/extend/plugins/wp-pagenavi/

  2. Dre4000
    Member
    Posted 1 year ago #

  3. the_magician
    Member
    Posted 1 year ago #

    Hey all,

    I've been ploughing through all the documentation I could find but I cannot get the pager to get past the first page. The pager shows up and displays the correct amount of paging elements yet when I click on "2", for instance, the URL changes to /page/2 yet it shows page one only.

    http://pastebin.com/QicCyaSH

    Any advice/direction would be greatly appreciated.

  4. Dre4000
    Member
    Posted 1 year ago #

    try this but make sure you backup first.

    <div id="inner-main-content">
    <?php while (have_posts()) : the_post(); ?>
    <h1><?php the_title(); ?></h1>
    <?php endwhile;?>
    <? $communityservice = "community-service"; ?>
    <?php $my_query = new WP_Query( array('category_name='.$communityservice.'&posts_per_page=1')); ?>
    <?php while ($my_query->have_posts()) : $my_query->the_post(); ?>
    <div class="news-container">
    <?php the_post_thumbnail('updates-thumb'); ?>
    <div class="news-intro" style="float:left; margin-left:10px; width:350px;">
    " class="link-title"><?php the_title(); ?>
    <p style="font-size:11px; margin:2px 0px 2px 0px;"><i>Posted <?php echo get_the_date(); ?> at <?php echo get_the_time(); ?></i></p>
    <p style="line-height:17px;">
    <?php short_excerpt(180) ?>
    " class="read-more">read more <span class="meta-nav">→</span>
    </p>
    
    </div>
    </div>
    <div class="clear"></div>
    
    <hr>
    <?php endwhile;?>
    <?php wp_pagenavi(array('query' => $my_query )); ?>
    </div>
  5. Dre4000
    Member
    Posted 1 year ago #

    at the magician, maybe you can probably change the name of one of the query because i see at the top that you have two $new_querys. Then run another wp_pagenavi with the new query name. Im not sure if it will work since im not a programmer so you probably understand it better than I if my suggestion will work or not.

  6. Dre4000
    Member
    Posted 1 year ago #

    at the magician, or you can probably add a second $new_query to the wp pagenavi alone. Im not sure if this is how you would do this but, you might get what im talking about.

    wp_pagenavi(array('query' => $new_query, $new_query ));

  7. the_magician
    Member
    Posted 1 year ago #

    @Dre4000 Thanks for the help but I was able to figure out the problem after taking a much needed break from work I was able to see clearly...

    Just needed to change:
    'paged' => get_query_var('paged'))
    to:
    'paged' => get_query_var('page'))

    It's detailed here (doh!): http://scribu.net/wordpress/wp-pagenavi/right-way-to-use-query_posts.html
    and the reason:
    http://codex.wordpress.org/Class_Reference/WP_Query#Pagination_Parameters

    For builds after 3.0.2

  8. Dre4000
    Member
    Posted 1 year ago #

    ok

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic

Tags

No tags yet.