Exclude blog category posts from slideshow

Viewing 9 posts - 1 through 9 (of 9 total)
  • #5598
    Maaaatt
    Participant

    Is is possible to exclude posts from the blog category from the slideshow?

    #5616
    Daniel Tara
    Keymaster

    In loop-slider.php you have a query_posts() function, add the following key to the arguments array: 'cat' => '-1,-2,-3'. Replace the numbers with the IDs of the categories you want to exclude.

    #5644
    Maaaatt
    Participant

    The following code does not work: ‘-1,-2,-4’); ?>

    Am I doing something wrong? The slider does not display, and navigation is not shown.

    • This reply was modified 12 years, 5 months ago by Maaaatt.
    #5646
    Maaaatt
    Participant

    Edit: I have now achieved this with a front page category excluder plugin.

    #6765
    bhall27
    Participant

    I’m trying to do this myself, I can’t get it to work, Maaatt what did you do to get it to work?

    #6766
    bhall27
    Participant

    Can you please post what you did and where in the code?

    #14001
    tpeila
    Participant

    Is there a code that can query what code(s) to INCLUDE not exclude?

    #14006
    tpeila
    Participant

    I figured it out, used WP Filter Post Category Plugin

    #14146
    iwbyte
    Participant

    For those who don’t want to get a plugin, here’s the code change:

    in loop-slider.php, look for this code:

    $args = array(
    'posts_per_page' => 4,
    'paged' => $paged,
    'ignore_sticky_posts' => 1
    );

    Yours may look slightly different if you changed the # of posts per page already. In my case, I wanted to ONLY use category #9, so I changed it to:
    $args = array(
    'posts_per_page' => 4,
    'paged' => $paged,
    'ignore_sticky_posts' => 1,
    'cat' => 9
    );

    Note the extra comma after the ‘previously-last’ line!

    If you want to exclude categories, you’d use the directions above, but instead of : ‘cat’ => 9 you’d use: ‘cat’ => ‘-1,-2,-3’

Viewing 9 posts - 1 through 9 (of 9 total)

You must be logged in to reply to this topic.