• Resolved elancer-team GmbH

    (@elancerteam)


    Hey,
    I got a problem with latest Version of Plugin and WordPress, so that I always got “No results found.”.

    I figured out, that after function load_template__search_results__wp_query calls load_template the global variable $wp_query has no results. Just the number of found_posts which is set in line 149 is present.

    So in the template that is loaded have_posts returns false.

    I guess it’s because query_posts overrides $wp_query. My quickfix was to change line 151, and pass the $data[‘query’] to the template:

    load_template( $data['template'], true, $data['query'] );

    In the template I called:

    <?php if ( $args->have_posts() ) : ?>
    <?php while ( $args->have_posts() ) : $args->the_post(); ?>

    Best regards
    elancer-team

Viewing 2 replies - 1 through 2 (of 2 total)
  • Plugin Support Elio Bruno

    (@ambrelio)

    Hi @elancerteam,

    If I understand correctly, you are using a custom template called search-results.php and located in your-theme-folder/searchwp-live-ajax-search/.

    Since version 1.8.0, a new template has been introduced which can be controlled from the plugin’s settings page. To use the new template, the old custom template should be removed from your theme.

    However the old template should still work as before.
    It is expected for the $wp_query to be empty as it will be populated by the query_posts.
    I guess therefore that something else is causing the issue.
    Does your website use any plugin to cache pages? If it does, was the cache cleared after making the changes to the plugin’s files?

    Thanks

    Plugin Support Karan

    (@kjswp)

    Hi?@elancerteam,

    We haven’t heard back from you in a few days, so I’m going to go ahead and close this thread for now. But if you’d like us to assist further, please feel welcome to continue the conversation.

    Thanks!

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