Archived topic
Search results in three columns
11 replies · Started by BreoganGal on July 1, 2021
Hi, I have done the two steps to put the search in three columns but it still keeps showing in one column. I have no cache, I don't know what it can be. I have added the two pieces of code you commented on in the functions.php:
add_filter( ‘generate_blog_get_column_count’,’tu_search_column_count’ );
function tu_search_column_count( $count ) {
if ( is_search() ) {
return 33;
}
return $count;
}
add_filter( 'option_generate_blog_settings', 'lh_search_columns' );
function lh_search_columns( $options ) {
if ( is_search() ) {
$options['column_layout'] = true;
}
return $options;
}
If you need I give you credentials to review it.
Hi there,
Looks like the quotation marks are wrong on the first block of code.
Try this instead:
add_filter( 'generate_blog_get_column_count','tu_search_column_count' );
function tu_search_column_count( $count ) {
if ( is_search() ) {
return 33;
}
return $count;
}
add_filter( 'generate_blog_get_column_count','tu_search_column_count' );
function tu_search_column_count( $count ) {
if ( is_search() ) {
return 33;
}
return $count;
}
add_filter( 'option_generate_blog_settings', 'lh_search_columns' );
function lh_search_columns( $options ) {
if ( is_search() ) {
$options['column_layout'] = true;
}
return $options;
}
This is the code of functions.php. still not working
Hi there,
did you resolve the issue as i tested the site and the search returned 3 columns:
With a category filter does not work

When that filter is applied it takes you to the 'blog' template which is set to 1 column.
Unless you want to change the main blog to 3 columns you would need to check with the Plugin author to see if it can use AJAX to filter the template or allow you to choose the search results template.
Ok, they have already solved it for me. But now I have the problem that the buy button does not appear in the search results. How can I insert it?
Can you open a new topic for the new question?
I'll mark this one as resolved.
Thanks :)
Hey guys
I used the code suggested here to make sure that my search layout does not display columns. Unfortunately on tablet view the search results are still displayed in 2 columns, see here:
https://www.cannabisanbauen.net/?s=faustregel
Scr: https://www.dropbox.com/s/ggktr41vwn7p45j/Screenshot%202021-10-23%20at%2013.00.15.png?dl=0
I am using the folling snippet below. How do I have to modify it so that the one column layout is also applied to tablet view?
add_filter( 'generate_blog_get_column_count','tu_search_column_count' );
function tu_search_column_count( $count ) {
if ( is_search() ) {
return 100;
}
return $count;
}
Hi there,
remove that snippet and try this instead:
add_filter( 'option_generate_blog_settings', 'lh_custom_search_results_page_settings' );
function lh_custom_search_results_page_settings( $options ) {
if ( is_search() ) {
$options['column_layout'] = false;
}
return $options;
}
If you're still having issues, please raise a new topic where you can share a link to your site ( in the Private Information field ) and we can take a look.
Awesome, that works now! thx for the quick support!
Glad to be of help!