[Support request] How to remove thumbnails from search result page

Home Forums Support [Support request] How to remove thumbnails from search result page

Home Forums Support How to remove thumbnails from search result page

Viewing 6 posts - 1 through 6 (of 6 total)
  • Author
    Posts
  • #1642857
    Silko

    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!

    #1643100
    David
    Staff
    Customer Support

    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:

    https://docs.generatepress.com/article/adding-php/

    #1643143
    Silko

    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?

    #1643163
    David
    Staff
    Customer Support

    Now add this PHP snippet:

    add_filter( 'generate_blog_columns', function( $columns ) {
        if ( is_search() ) {
            $columns = false;
        }
    
        return $columns;
    } );
    #1643182
    Silko

    Perfect, thanks!

    #1643214
    David
    Staff
    Customer Support
Viewing 6 posts - 1 through 6 (of 6 total)
  • You must be logged in to reply to this topic.