Dynamic Pagination using $count
-
Hi,
I’ve been battling with trying to exclude posts from a category on the Tanuka theme. Have finally got it working with this code:
<?php if (have_posts()) : if ( $is_top_single ) $GLOBALS['more'] = false; //important while (have_posts()) : the_post(); if (in_category('6')) continue; ?> <?php static $count = 0; if ($count == "7") { break; } else { ?>
……etc, and then:
<?php $count++; } ?>
So basically it’s removing posts from category 6, but then the counter is adding up posts which are being listed and then breaks after 7, so I can have a consistent amount of posts on the homepage.
Only problem is that this breaks the pagination now, as I’ve set wordpress posts to show ’30’ to be safe (so all 7 from the categories (excluding cat 6) are show).
Now my question is, is it possible to use pagination when count==”7″, so that it paginates 7 posts per page, EXCLUDING category 6.
Hope this makes sense…?
Viewing 6 replies - 1 through 6 (of 6 total)
Viewing 6 replies - 1 through 6 (of 6 total)
- The topic ‘Dynamic Pagination using $count’ is closed to new replies.