Site logo

Archived topic

How to do: 3 columns by default and 2 colums for a special category ?

5 replies · Started by jmarc on February 19, 2023

Viewing posts 1–6 of 6

Hello

I would like to get what is in the title please but I cannot do it alone.
Need some help cause I guess it' possible with this code but I don't knkow how to modify it.

This code is for "search" and I would like to get 2 columns for the category ID 77
Thank you

add_filter( 'generate_blog_get_column_count','tu_search_column_count' );
function tu_search_column_count( $count ) {
    if ( is_search() ) {
        return 33;
    }

    return $count;
}

Hi there,

try this:

add_filter( 'generate_blog_get_column_count','tu_search_column_count' );
function tu_search_column_count( $count ) {
    if ( is_category( '9' ) ) {
        return 50;
    }

    return $count;
}

change the 9 to your category ID

Works perfect David !!!
Thank's a lot !

Is the a way to modify the "h2 .entry-title" now on those two columns only (it's really big on mobile !!!)
Maybe using another code ?

JMarc

Never mind I found it

.category-blog h2 {
font-size:22px;
}

Thank you
JMArc

Resolved

Glad to hear that!

This archived topic is closed to new replies.