• Need help using page_navi on the sidebar. I have 2 columns. left and right. sidebar.php(left) and single.php(right)

    Page navi is loaded on the sidebar.php
    content is loaded on single.php

    If you click on a post on the sidebar (say page 3) the content loads on the single.php however the sidebar reloads it’s query back to page 1. As it should since single.php calls the get_sidebar again. Is there a way to keep the same query and pass it on the single.php.

    sample: https://ronreeser.com/wp/?cat=1&paged=3

    click on any of the post – and noticed the sidebar loads back to page 1

    code on sidebar.php
    ====================
    <?php if (is_single()) : ?>

    <?php if (in_category(RELEASES_CAT)) : ?>

    <div id=”col_one” class=”left”>
    <h2>Releases</h2>
    <?php query_posts($query_string . ‘&cat=’.RELEASES_CAT. ‘&posts_per_page=5′.’&paged=’. get_query_var(‘paged’)); ?>
    <?php if (have_posts()) : ?>
    <?php while (have_posts()) : the_post(); ?>

    <div class=”release”>
    <?php if ( get_post_meta($post->ID, RELEASE_IMG, true) ) : ?>
    <div class=”image left”>
    “><img src=”<?php bloginfo(‘url’); ?>/<?php echo get_post_meta($post->ID, RELEASE_IMG, true); ?>” />
    </div>
    <?php endif; ?>
    </div>
    <div class=”clear”></div>
    </div>
    <?php endwhile; ?>

    <?php wp_pagenavi(); ?>
    <?php endif; ?>
    <?php wp_reset_query(); ?>
    </div>
    ============================

    code on single.php
    ==================
    get_header();
    get_sidebar(); ?>
    <?php the_content(); ?>

    Thanks

  • The topic ‘PageNavi on sidebar’ is closed to new replies.