• Resolved Bocq

    (@bocq)


    Hello,
    I have excluded some categories from the home page, which works fine by first loading the page.
    But when I select “show all” once more, the exculded categories are shown again.
    Should I change data-filter="*" ? How?

    Thanks a lot.

    The Test site:

    The code:

    <ul class="nav-listing clearfix">
    
            <li><a href="#" data-filter="*" class="selected"><span></span><?php _e('Show All','sampression'); ?></a></li>
           <?php
    		$args = array(
    		'exclude'=>  array(8,9,10,11,12)
    		);
    		$categories = get_categories($args);
            foreach($categories as $category):
            ?>
            <li><a href="javascript:void(0);" data-filter=".<?php echo $category->slug; ?>" id="<?php echo $category->slug; ?>" class="filter-data"><span></span><?php echo $category->name; ?></a></li>
            <?php
            endforeach;
            ?>
        </ul>

Viewing 1 replies (of 1 total)
  • if you do not want the post from the particular category on the posts as well you have to add ‘category__not_in’ => array(category_ids) argument in the query that is in the index.php file.

    Please find

    query_posts( array(
    		'post__not_in' => get_option( 'sticky_posts' ),
    		'paged' => $paged
    		) 
    
    );

    in the index.php file and replace it by

    query_posts( array(
    		'post__not_in' => get_option( 'sticky_posts' ),
                    'category__not_in' => array(category ids separated by comma),
    		'paged' => $paged
    		) );

    Hope this is what you are looking for.

Viewing 1 replies (of 1 total)
  • The topic ‘Excluded categories appear by "Show all"’ is closed to new replies.