Empty search on child site

Home Forums Product Support Forums Ajax Search Pro for WordPress Support Empty search on child site

This topic contains 7 replies, has 2 voices, and was last updated by Ernest Marcinko Ernest Marcinko 3 years, 10 months ago.

Viewing 8 posts - 1 through 8 (of 8 total)
  • Author
    Posts
  • #19304
    makedifferent
    makedifferent
    Participant

    Hi!

    We bought Ajax Search Pro for our multisite and didn’t manager to make it work on our child site.
    The ajax search when typing a word works, but the search page tel us there is no result on this site.
    We tried to rebuild the index.
    Could you take a look and explain how to fix/configure this ?
    This is a development server and we will manually fix the production site with your feedback.

    If you need more information, feel free to ask.

    Have a nice day !

    #19307
    Ernest Marcinko
    Ernest Marcinko
    Keymaster

    Hi!

    Thank you for all the details, it helped me a lot!

    I have found a possible issue, and resolved it. Now I am seeing the same results on the results page, as on the live results list. One of the main post filters was not executed for some reason. Either it is de-registered somewhere, or it is missing, I am not sure. Anyways, I have added this line to the search.php child theme file, to the top:

    $wp_query->posts = apply_filters('posts_results', $wp_query->posts, $wp_query);

    That will make sure to allow search results override. I have also added these lines to the functions.php file as well, to resolve the blog switching for multisite results:

    function asp_fix_the_post_action( $post_object ) {
    	if ( 
        isset($post_object->blogid, $post_object->asp_id) && 
        !empty($post_object->asp_id) &&
        get_current_blog_id() != $post_object->blogid &&
        isset($_GET['s'])
       ) {
        switch_to_blog($post_object->blogid); 
        $np = get_post($post_object->asp_id); 
        $post_object->ID = $np->ID;
        $post_object->post_type = $np->post_type;
      }                                    
    }
    add_filter( 'the_post', 'asp_fix_the_post_action' );

    These should do the trick.

    Best,
    Ernest Marcinko

    If you like my products, don't forget to rate them on codecanyon :)


    #19339
    makedifferent
    makedifferent
    Participant

    Hi Ernest !

    We still have a problem with the plugin.
    When you try de find “Peinture” on a child site, the search say there is 168 results, but nothing appear.

    Could you take a look ?

    Have a nice day.

    #19340
    Ernest Marcinko
    Ernest Marcinko
    Keymaster
    You cannot access this content. Best,
    Ernest Marcinko

    If you like my products, don't forget to rate them on codecanyon :)


    #19348
    makedifferent
    makedifferent
    Participant

    Hi Ernest,

    Thank you for you help, now the plugin works with our subsites but we encounter a new bug that we can’t find the source.

    Has you said, we have a 404 error when we use pagination on child site.
    I’m not an expert on permalink and htaccess. Do you have any clue to help us fixe this ?

    Have a nice day.

    #19353
    Ernest Marcinko
    Ernest Marcinko
    Keymaster

    Hi,

    Unfortunately I am not expert either. Usually changing the permalink options, or reverting them to defaults at first is the good place to start.

    Best,
    Ernest Marcinko

    If you like my products, don't forget to rate them on codecanyon :)


    #20009
    makedifferent
    makedifferent
    Participant

    Hi Ernest,
    I managed to fix somes issues, by changing the way to pass my pagination into my url parameters, but got last issue to fix, and i think it’s due to your previous code in fontction.php.
    I think your code doesn’t maneged paged parameter when i tried to get the posts.
    Despite the fact i was on page 1 or 5, i get the first 12 posts.
    Can you hep me find where i can pass this parameter
    Thanks.

    #20031
    Ernest Marcinko
    Ernest Marcinko
    Keymaster

    Hi!

    If your remove the code, does that make any difference? That should not affect the pagination as far as I know, because the ‘post_results’ filter should always pass the current results, from the current page.
    For the wordpress pagination to work, the

    $_GET['paged']

    and the

    $wp_query->query_vars['paged'];

    ..variables should be set. They are usually set automatically, when the page URL is accessed, and the ‘paged’ argument is set, such as http://yoursite.com?s=1&paged=2 -> the &paged=2 tells, that the current page is page 2.

    Best,
    Ernest Marcinko

    If you like my products, don't forget to rate them on codecanyon :)


Viewing 8 posts - 1 through 8 (of 8 total)

You must be logged in to reply to this topic.