• Resolved jeremy2s

    (@jeremy2s)


    Hi Bill,

    I have your Grid plugin working on my site. I was also able to use the following code to exclude one of the categories from using the grid:

    function be_limit_grid_loop( $display, $query ) {
    	if( $query->is_main_query() && $query->is_category() && genesis_get_option( 'grid_on_category', 'genesis-grid' ) ) {
    		if( $query->is_category( 'featured' ) )
    			$display = false;
    		else
    			$display = true;
    	}
    
    	return $display;
    }
    add_filter( 'genesis_grid_loop_section', 'be_limit_grid_loop', 10, 2 );

    That worked great – appreciate the snippet.

    My question is how would I tweak this code to be able to exclude multiple categories? I would like to use the grids on all but 2 of the categories.

    Thanks in advance for any help you can give.

    ~ Jeremy

    https://wordpress.org/plugins/genesis-grid-loop/

Viewing 2 replies - 1 through 2 (of 2 total)
  • Plugin Author Bill Erickson

    (@billerickson)

    Change this:

    if( $query->is_category( ‘featured’ ) )

    To this:

    if( $query->is_category( array( ‘featured’, ‘another-category’ ) ) )

    Thread Starter jeremy2s

    (@jeremy2s)

    That worked great…thanks for the help.

    ~ Jeremy

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Exclude Multiple categories from using the grid’ is closed to new replies.