[Resolved] custom search result page

Home Forums Support [Resolved] custom search result page

Home Forums Support custom search result page

Viewing 15 posts - 1 through 15 (of 16 total)
  • Author
    Posts
  • #886161
    Michael

    Hi i tried to make a custom result page . i tried to add the function in
    https://docs.generatepress.com/article/option_generate_blog_settings/
    but it doesnt work, i trited to put it in function.php or using plugin code snipet.
    neither does the job.
    i am using generate press theme and plugin.

    #886696
    Leo
    Staff
    Customer Support

    Hi there,

    What are you trying to achieve?

    Can you provide the code you used?

    Make sure to highlight them and click the code button when posting here.

    Let me know πŸ™‚

    #886894
    Michael

    im trying to make customize my search result page like post, remove widget and header etc
    i am using the code from documentation example

    add_filter( 'option_generate_blog_settings', 'lh_custom_search_results_page_settings' );
    function lh_custom_search_results_page_settings( $options ) {
        if ( is_search() ) {
    	$options['read_more_button'] = true;
    	$options['date'] = false;
    	$options['categories'] = false;
    	$options['tags'] = false;
    	$options['comments'] = false;
            $options['infinite_scroll'] = true;
    	$options['infinite_scroll_button'] = true;
    	$options['masonry_load_more'] = 'More search results';
    	$options['post_image'] = true;
    	$options['post_image_position'] = 'post-image-above-header';
    	$options['post_image_alignment'] = 'post-image-aligned-center';
    	$options['column_layout'] = false;
    	$options['featured_column'] = true;
    	$options['masonry'] = false;
        }
      
        return $options;
    }

    im trying to put in code snipet and function.php but it didnt work

    #887047
    Tom
    Lead Developer
    Lead Developer

    Hi there,

    I’m not sure that function is what you’re after.

    Are you wanting your search results not to have a sidebar?

    If so, you can:

    1. Create a Layout Element: https://docs.generatepress.com/article/layout-element-overview/
    2. Set the sidebar layout
    3. Set the Display Rules to “Search Results”

    Let me know πŸ™‚

    #887294
    Michael

    That is what i need, thank you tom.
    i have get rid of sidebar and all elements that i dont need. but the search result layout is not very nice
    is there a way to display search result like plugin wp_show_posts

    thank you

    #888061
    Tom
    Lead Developer
    Lead Developer

    It depends on how you’re using WP Show Posts. You can set up columns etc.. using the Blog module in Customize > Layout > Blog.

    Let me know πŸ™‚

    #891244
    Michael

    im trying to modify search result,
    in Blog module in Customize > Layout > Blog.
    theres only option for archive and single, no option for search result page?

    #891252
    Leo
    Staff
    Customer Support
    #892567
    Michael

    i have tried to use the code and put it in code snippet or function.php but it doesnt work

    this code:
    add_filter( ‘generate_blog_get_column_count’,’tu_search_column_count’ );
    function tu_search_column_count( $count ) {
    if ( is_search() ) {
    return 33;
    }

    return $count;
    }

    #892975
    Leo
    Staff
    Customer Support

    That code should work.

    Have you tried clearing the caching plugin and disable it as we suggested in the start a new topic checklist?

    What can I search to see the search result page? The site isn’t in English.

    Let me know πŸ™‚

    #893093
    Michael

    i have cleared the caching and disable it in plugin section
    this is the link to the search result page
    https://agenkutus.com/?s=si

    #893295
    Leo
    Staff
    Customer Support

    Hmm the code should definitely work.

    Are you currently adding it using Code Snippets?

    Can you make sure the snippet is actually activated?

    #893432
    Michael

    im using code snipet and its activated.

    #893506
    Tom
    Lead Developer
    Lead Developer

    Is the columns option turned on in the Customizer?

    If not, you may need to add this as well:

    add_filter( 'generate_blog_columns', function( $columns ) {
        if ( is_search() ) {
            return true;
        }
    
        return $columns;
    } );
    #893953
    Michael

    it works now tom, thank you

Viewing 15 posts - 1 through 15 (of 16 total)
  • You must be logged in to reply to this topic.