WordPress.org

Ready to get started?Download WordPress

Forums

[resolved] exclude category in Mixfolio template (3 posts)

  1. fantasmo
    Member
    Posted 6 months ago #

    Hello,

    i wanted to exclude one category from the dislayed posts in the Mixfolio template.

    I guess I already find the right part of the code (main index template) but the way I entered the exclude code doesn't work:

    THE CODE:

    <?php
    					$paged = ( get_query_var( 'paged' ) ) ? get_query_var( 'paged' ) : 1;
    
    					$grid_args = array(
    						'posts_per_page' => get_option( 'posts_per_page' ),
    						'paged' => $paged,
    					);
    
    					$grid_query = new WP_Query( $grid_args );
    
    					while ( $grid_query->have_posts() ) : $grid_query->the_post();
    				?>

    I entered "cat=-1" in this code area

    get_option( 'posts_per_page' ), 'cat=-1',
    						'paged' => $paged,

    How do I have to write it?
    The code doesn't look exactly like in the wordpress documentation.

  2. keesiemeijer
    moderator
    Posted 6 months ago #

    Try it with this:

    $grid_args = array(
    	'cat'            => -1,
    	'posts_per_page' => get_option( 'posts_per_page' ),
    	'paged'          => $paged,
    );
  3. fantasmo
    Member
    Posted 6 months ago #

    Yes it worked. Great!
    Thank you :-)

Reply

You must log in to post.

About this Topic