We cannot display this gallery using offset and pagination loops
-
Hi. I am having probs with widget slideshow.
It worked pefectly until i did some modify to my loops for displaying posts.
i use two loops. One to show the 1st post, and offset to display others excluding the previous:
my code:
function my_post_limit($limit) { global $paged, $myOffset; if (empty($paged)) { $paged = 1; } $postperpage = intval(get_option('posts_per_page')); $pgstrt = ((intval($paged) -1) * $postperpage) + $myOffset . ', '; $limit = 'LIMIT '.$pgstrt.$postperpage; return $limit; } //end function my_post_limit
1st loop:
<?php $cat_id = get_query_var('cat'); ?> <?php if ($paged < 2 ){ $post_query = 'cat='.$cat_id.'&posts_per_page=1'; ?> <?php query_posts( $post_query ); ?> <?php if (have_posts()) : ?> <?php while (have_posts()) : the_post();
2nd loop using offset and pagination:
<?php add_filter('post_limits', 'my_post_limit'); ?><?php global $myOffset; $myOffset = 1; $temp = $wp_query; $wp_query= null; $wp_query = new WP_Query(); $wp_query->query('cat='.$cat_id.'&offset='.$myOffset.'&paged='.$paged); ?> <div id="posts-list-category"> <?php if (have_posts()) : ?> <?php while ($wp_query->have_posts()) : $wp_query->the_post(); ?>
WELL. after using add_filter(‘post_limits’, ‘my_post_limit’);
images on widget slidshow disappear and i get We cannot display this gallery
If i remove the filter. slideshows works but pagination is broken.any help?
Viewing 3 replies - 1 through 3 (of 3 total)
Viewing 3 replies - 1 through 3 (of 3 total)
- The topic ‘We cannot display this gallery using offset and pagination loops’ is closed to new replies.