Site logo

[Resolved] Search Results Filter

Home Forums Support [Resolved] Search Results Filter

Home Forums Support Search Results Filter

Viewing 4 posts - 1 through 4 (of 4 total)
  • Author
    Posts
  • #1573149
    Sourabh

    HI David/Tom,

    I have created a search page but when I search any post, So along with post, Pages also coming in to search results, so how to filter that, I contacted with elementor team so they said it could be done via custom CSS and I need to contact theme developer for that, See if you can help to apply such filter –

    https://www.dropbox.com/s/rtym5rzo50d6vms/pages%20in%20search%20results.png?dl=0

    the above image will you an idea of what I am trying to say.

    #1573276
    Leo
    Staff
    Customer Support

    Hi there,

    If you are referring to GP’s navigation search option in the main navigation then this PHP snippet should work:

    add_filter( 'generate_navigation_search_output', function() {
        printf(  
            '<form method="get" class="search-form navigation-search" action="%1$s">
                <input type="search" class="search-field" value="%2$s" name="s" title="%3$s" />
                <input type="hidden" name="post_type" value="post" />
            </form>', 
            esc_url( home_url( '/' ) ), 
            esc_attr( get_search_query() ),   
            esc_attr_x( 'Search', 'label', 'generatepress' ) 
        ); 
    } );

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

    #1574034
    Sourabh

    Okay Thanku, I will Try and Update…

    #1574680
    Leo
    Staff
    Customer Support

    Sounds good 🙂

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