I have three loops, one in the main column, and two in the right sidebars. Via the theme options page the user can decide which categories of posts to show in the sidbar loops while the loop in the main column is to show all latest posts except from the two selected categories.
Problem 1: The main column loop only excludes the posts from selected category in one of the sidebars. The other still shows in the main loop.
Problem 2: During all this loop fixing, the pagination (link to Older Posts furthest down), doesn't work.
Send me an email to [email protected] and I'll send the login details.
Sébastien | French WordpressDesigner answers:
in the file myhome.php
replace
<?php $exc = get_category_id ( ( get_option('mmcp_sidecat') ? get_option('mmcp_sidecat') : 'uncategorized') ); ?>
<?php $paged = (get_query_var('paged')) ? get_query_var('paged') : 1; query_posts('cat=-'.$exc.'&posts_per_page=5&
paged=' . $paged); ?>
by
<?php
$exc = get_category_id ( ( get_option('mmcp_sidecat') ? get_option('mmcp_sidecat') : 'uncategorized') );
$exc_two = get_category_id ( ( get_option('mmcp_sidecat2') ? get_option('mmcp_sidecat2') : 'uncategorized') ); ?>
<?php $paged = (get_query_var('paged')) ? get_query_var('paged') : 1; query_posts('cat=-'.$exc.',-'.$exc_two.'&posts_per_page=5&
paged=' . $paged); ?>
Sébastien | French WordpressDesigner comments:
about the pagination
replace
<?php $paged = (get_query_var('paged')) ? get_query_var('paged') : 1;
query_posts('cat=-'.$exc.'&posts_per_page=5&paged=' . $paged); ?>
by
<?php $page = get_query_var( 'page' );
query_posts('cat=-'.$exc.'&posts_per_page=5&paged=' . $page); ?>
Sébastien | French WordpressDesigner comments:
I have edit the first message because the line which start by "$exc_two" must use mmcp_sidecat2 (and no mmcp_sidecat)
it's very important :-)
David Navarrete answers:
you can try with this type of loop?
<?php $query = new WP_Query(array('category__not_in' => array(1,2,3), 'showposts' => 10 )); ?>
<?php if ( $query->have_posts() ) : while ( $query->have_posts() ) : $query->the_post(); ?>
Chris Lee answers:
You could just install Advanced category excluder to solve this:
http://wordpress.org/extend/plugins/advanced-category-excluder/