Archived topic
How to remove thumbnails from search result page
5 replies · Started by Silko on February 2, 2021
I found some threads about styling the search results but nothing did help me to remove the thumbnails only for the search results. I am not good in coding by the way ;)
Thanks a lot in advance!
Hi there,
add this PHP Snippet to your site:
add_filter( 'option_generate_blog_settings', 'lh_custom_search_results_page_settings' );
function lh_custom_search_results_page_settings( $options ) {
if ( is_search() ) {
$options['post_image'] = false;
}
return $options;
}
This articles provides more information on using that filter:
https://docs.generatepress.com/article/option_generate_blog_settings/
And this article explains how to add the code to your site:
Thank you David. It is working :)
Just one more question please. Is it also possible to change the column layout only for the search results? I am using columns and thumbnails for the archive (customizer -> layout -> blog) Its working great for my project.
But for the search result page a one coloum layout (the same layout when you dont choose the column option via customizer) just with title and excerpt would be better. Is that possible?
Now add this PHP snippet:
add_filter( 'generate_blog_columns', function( $columns ) {
if ( is_search() ) {
$columns = false;
}
return $columns;
} );
Perfect, thanks!
You're welcome