Site logo

Archived topic

Blog vs. WooCommerce conflict again?

23 replies · Started by Peter Duggan on March 25, 2018

Viewing posts 16–24 of 24

Sounds good, Peter! Glad I could help :)

Well, this works (appended to my 'child' functions.php) for the other thing I wanted:

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

    return $count;
}

Maybe not the best or only way (?), but it's the one I've got to work!

That would set the width of the posts to 100%.

It sets the width of the search results to 100% but leaves the Blog home page post summaries in columns and Masonry layout, which is what I wanted.

Ah, you could probably just do this then:

add_filter( 'generate_blog_columns', 'tu_disable_search_columns' );
function tu_disable_search_columns( $columns ) {
    if ( is_search() ) {
        return false;
    }

    return $columns;
}

Yes, that works too. I just found the other way first, acknowledging 'Maybe not the best or only way'. If the new way's preferable/more elegant, I'll keep it. :-)

The way I provided will prevent all of the columns code from loading, so it's a little lighter :)

Perfect, Tom... thanks again! :-)

You're welcome! :)

This archived topic is closed to new replies.