• Hello,

    I am working on a website, I am using wp show posts on search results page.

    I am using this code shared by tom in one of the forum.

    add_action( 'generate_before_main_content', function() {
        if ( is_search() ) {
            wpsp_display( 15135 );
        }
    } );
    
    add_filter( 'wpsp_query_args', function( $query, $settings ) {
        if ( 15135 === (int) $settings['list_id'] ) {
            $query->set( 's', esc_html( $_GET['s'] ) );
        }
    
        return $query;
    } );
    
    add_filter( 'generate_has_default_loop', function( $has_loop ) {
        if ( is_search() ) {
            return false;
        }
    
        return $has_loop;
    } );

    (Using wp show posts with ID 15135)

    It works, but for the item which I made in the wp show posts, I selected no category or tag, so that is why it shows all the posts first and then the search results item.

    For example on this page,

    https://staging16.brookingindustries.com/?s=tempest

    I searched a query Tempest (which is a page basically) it works, it shows in the end, but above you will see it fetches all the posts I have on the website.

    Any help would be appreciated.

    Thank you in advance!

Viewing 1 replies (of 1 total)
  • Plugin Support Elvin

    (@ejcabquina)

    Hi there,

    The staging site’s front-end seems to be locked behind a password. I’m unable to check if it actually has any issues.

    Any chance you can send the credentials on our contact page?
    https://wpshowposts.com/contact/

    Let us know. ??

Viewing 1 replies (of 1 total)
  • The topic ‘Search results using wp shows posts, showing posts first’ is closed to new replies.