Manipulate loop-slider.php to exclude a specific tag from query_posts

Viewing 2 posts - 1 through 2 (of 2 total)
  • #3296
    amq
    Participant

    Hi,

    as many others I was looking for a way to exclude one or more blogposts from the home-page slider.

    With you tip @Daniel to look into the loop-slider.php I read on about query_posts and how to fiddle with it.

    I thus resorted to giving the posts I want to exclude a certain tag \\\”exclude\\\” (tag_id 18 for me) which I wanted to exclude.

    Your original $args for query_posts were defined and executed here:

    [code] global $wp_query, $query_string;
    $paged = get_query_var( ‘paged’ );
    $args = array(
    ‘posts_per_page’ => 4,
    ‘paged’ => $paged,
    ‘ignore_sticky_posts’ => 1
    );
    $args = wp_parse_args( $args, $wp_query->query );
    ?>
    <?php query_posts( $args ); ?>[/code]

    To exclude my specific tag I needed to include [b]’tag__not_in’ => array(18),[/b] somewhere. So what I changed your $args-array to was just:

    [code] global $wp_query, $query_string;
    $paged = get_query_var( ‘paged’ );
    $args = array(
    ‘posts_per_page’ => 4,
    [b]’tag__not_in’ => array(18),[/b]
    ‘paged’ => $paged,
    ‘ignore_sticky_posts’ => 1
    );
    $args = wp_parse_args( $args, $wp_query->query );
    ?>
    <?php query_posts( $args ); ?>[/code]

    Yet – this has absolutely no effect at all on the homepage slider. The post tagged with “exclude” is still shown in the slider.

    Where did I step wrong?

    The webpage is the following: http://www.amarquardt.de and the post to be exluded is http://photoblog.amarquardt.de/2011/10/24/paris-paris/ (tagged “exclude” of course).

    Thanks for the help!

    Bregs
    Amq

    #3297
    amq
    Participant

    Ouch… forget it. I only forgot to empty my page cache after doing the edits. Of course the code above works.

    Thanks David for the clue :)!

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

You must be logged in to reply to this topic.