Custom loop pagination
-
hi guys, here’s what i did: i created a custom loop on Single-post which lists the posts of a category provided by a custom field. the problem is, the pagination didn’t work at all, it always returns to the first page. i’m trying to find something on Google for a few days now (it seems to be a common issue) and i’m trying all these different codes but without any success
can anybody help me? i’m gonna put here the things that i’d tried and didn’t work<?php $my_query = new WP_Query(array( 'cat' => get_post_meta($post->ID, 'epicat', true), ‘orderby’ => ‘menu_order’, 'caller_get_posts' =>1, ‘paged’ => $paged, 'posts_per_page' => 8, )); if ($my_query->have_posts()): ?> <?php while ($my_query->have_posts()) : $my_query->the_post(); ?><?php $paged = get_query_var( 'page' ) ? get_query_var( 'page' ) : 1; $args = array( 'posts_per_page' => 8, 'paged' => $paged, 'cat' => 128 ); $loop = new WP_Query($args); while ($loop->have_posts()) : $loop->the_post(); ?><?php $temp = $wp_query; $wp_query= null; $wp_query = new WP_Query(); $wp_query->query('showposts=5'.'&paged='.$paged); ?> <?php while ($wp_query->have_posts()) : $wp_query->the_post(); ?><?php global $paged; $this_page = $_GET['page']; $paged = $this_page; $my_query = new WP_Query(array( 'cat' => get_post_meta($post->ID, 'epicat', true), 'posts_per_page' => 8, )); if ($my_query->have_posts()): ?> <?php while ($my_query->have_posts()) : $my_query->the_post(); ?>PS: i’m using the Kriesi’s pagination, but the issue doesn’t seem to be there since the result is the same with next_posts_link() and previous_posts_link()
The topic ‘Custom loop pagination’ is closed to new replies.