jackiepeters
Forum Replies Created
Viewing 1 replies (of 1 total)
-
Forum: Fixing WordPress
In reply to: WP Magazeen Theme Paginationhey ryan, i couldn’t get your code to work for me, but i had already moded and hacked it to the point that it’s barely recognizable any more. what i did though was something like this, in case anyone else wants an alternate method. this actually works for pagination on any custom loop with query_posts. In the case of magazeen there are three queries with interdependent offsets, so it’s math based on page number. i am not really a “coder” but i can make stuff work, so this may not be neat or elegant.
The code below determines what page you’re on and sets the offset as a variable based on the formula (pagenumber – 1) * n + y where n is number of posts you have on your page and y is the offset for each query in relation to the first post.
<?php $paged = (get_query_var('paged')) ? get_query_var('paged') : 1; $newpaged = $paged-1; $pagedi = strval($newpaged) * 11; settype($pagedi, "integer"); query_posts( 'showposts=3&offset='.$pagedi ); if (have_posts()) : while (have_posts()) : the_post(); $category = get_the_category(); ?> //stuff here <?php endwhile; endif; ?> <?php $pagedj = $pagedi +3; query_posts( 'showposts=4&offset='.$pagedj ); if (have_posts()) : $counter = 0; while (have_posts()) : the_post(); $category = get_the_category(); if( $counter % 2 == 0 ) $end = ""; else $end = "last"; ?> //stuff here <?php $counter++; endwhile; endif; ?> <?php $pagedk = $pagedi+7; query_posts( 'showposts=5&offset='.$pagedk ); if (have_posts()) : while (have_posts()) : the_post(); $category = get_the_category(); ?> //stuff here <?php endwhile; endif; ?>
Viewing 1 replies (of 1 total)