logo
Ask your WordPress questions! Pay money and get answers fast! (more info)

Warning: Please do not give out any FTP or ssh credentials to anyone, unless you trust them completely. Giving out login details is dangerous.

If the asker does not get an answer then they have 10 days to request a refund.

$50
Exclude categories from loop and pagination problems

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 sven.salmonsson@gmail.com and I'll send the login details.

This question has been answered.

LeTune | 02/03/11 at 10:01am Edit


The experts have suggested, on average, a prize of $20 for this question.

(5) Possible Answers Submitted...

See a chronological view of answers?

Warning: Please do not give out any FTP or ssh credentials to anyone, unless you trust them completely. Giving out login details is dangerous.

  • avatar
    Last edited:
    02/03/11
    10:06am
    Oleg Butuzov says:

    sent details. from email butuzov@made.com.ua

  • avatar
    Last edited:
    02/03/11
    10:09am
    David Navarrete says:

    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(); ?>

  • avatar
    Last edited:
    02/03/11
    10:22am
    Marvin Shaker says:

    Add <?php wp_reset_query(); ?> After Each Loop

  • avatar
    Last edited:
    02/03/11
    10:29am
    Chris Lee says:

    You could just install Advanced category excluder to solve this:

    http://wordpress.org/extend/plugins/advanced-category-excluder/

  • avatar
    Last edited:
    02/03/11
    12:25pm
    Sébastien | French WordpressDesigner says:

    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); ?>

    Previous versions of this answer: 02/03/11 at 11:55am | 02/03/11 at 12:03pm

    • 02/03/11 12:00pm

      Sébastien | French WordpressDesigner says:

      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); ?>

    • 02/03/11 12:06pm

      Sébastien | French WordpressDesigner says:

      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 :-)

This question has expired.





Current status of this question: Completed



Warning: Please do not give out any FTP or ssh credentials to anyone, unless you trust them completely. Giving out login details is dangerous.

If the asker does not get an answer then they have 10 days to request a refund.