• Hello,
    i’m trying to solve a problem in a templates i use as hompage in WP.

    I’ve differents loops and i need one that:
    1- excludes sticky post
    2- excludes post from some categories

    I found this:

    <?php $sticky = get_option('sticky_posts') ;
    $post_to_exclude[] = $sticky[0];
    
    $args=array(
       'cat' =>-4,
       'caller_get_posts'=>1,
       'showposts'=>2,
       'post__not_in'=> $post_to_exclude,
    );
    query_posts($args); ?>

    which excludes sticky posts and post from category 4.
    But i can’t find a way to exclude another category (let’s say 4 AND 6).

    I tryed many versions, for example

    $args=array(
     'category_and' => array(-4,-6),
       'caller_get_posts'=>1,
       'showposts'=>2,
       'post__not_in'=> $post_to_exclude,
    );

    but the filter doesn’t filter, i mean, when i don’t get errors the filter pass all the post from all the categories.

    Any idea?
    Thanks a lot,
    Molokom

Viewing 2 replies - 1 through 2 (of 2 total)
Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘exclude sticky post and categories in loop’ is closed to new replies.