Forums

[Plugin: WP-PageNavi] Custom query on category.php (3 posts)

  1. jhkb
    Member
    Posted 4 months ago #

    Hi all,

    I was really hoping to avoid asking here, but i'm well and truly stumped. I've implemented every piece of advice I can find and still pagination is not working for me.

    Here's the link to the page i'm testing it on: http://amelieslarder.bmjt.co.uk/category/recipes - a WIP so please ignore the styling etc.

    I'm using the query below, i've tested all my plugins, tried default permalinks, taken out other queries in my sidebar, renamed my category page to remove the slug and still when I hit page 2, the default index.php appears.

    <?php if (have_posts()) : ?>
    			<?php $my_query = new WP_Query( array( 'cat' => '3', 'posts_per_page' => '3', 'paged' => get_query_var('paged') )); ?>
    			<?php while ($my_query->have_posts()) : $my_query->the_post(); ?>
    [......]
    <?php endwhile; wp_pagenavi( array( 'query' => $my_query ) ); ?>
      		<?php wp_reset_postdata(); ?>

    Is there anything else I can try, or something crucial I've forgotten?
    Thanks in advance!

  2. jhkb
    Member
    Posted 4 months ago #

    Anyone?

  3. jhkb
    Member
    Posted 4 months ago #

    Ok found my problem! Realised I didn't even need to use a custom query (was only setting the category and posts per page), so created a taxonomy template and set the posts per page in the reading settings and all is well. My homepage is a series of custom queries anyway so the reading settings won't interfere with that.

Reply

You must log in to post.

About this Topic