Viewing 6 posts - 1 through 6 (of 6 total)
  • Author
    Posts
  • #1137303

    Hi,

    When I make on my website a search that I know shouldn’t find any result, I get weird result of pages or date.
    Please check out my website and search for example for Dog.
    I know there is no Dog related post or pages.
    the result I get are not normal.
    How can I get rid of them? I just want to have NO RESULT FOUND
    here is the custom loop-search.php that I have https://pastebin.com/cRV2WbkV
    Thanks

    Olivier

    • This topic was modified 2 months, 1 week ago by  coumoliv.
    #1138125

    Hey coumoliv,

    Can you share backend details? What search related plugins u have enabled?

    Best regards,
    Basilis

    #1138186

    Hi Basilis,
    I have Relevanssi instaled but the issue happen only when I replaced the code to have my results in column.
    I change the initial code portion in search.php by :

    if(!empty($_GET[‘s’]))
    {
    echo “<h4 class=’extra-mini-title widgettitle’>{$results}</h4>”;

    global $posts;
    $post_ids = array();
    foreach($posts as $post) $post_ids[] = $post->ID;

    $atts = array(
    ‘type’ => ‘grid’,
    ‘items’ => get_option(‘posts_per_page’),
    ‘columns’ => 4,
    ‘class’ => ‘avia-builder-el-no-sibling’,
    ‘paginate’ => ‘yes’,
    ‘use_main_query_pagination’ => ‘yes’,
    ‘custom_query’ => array( ‘post__in’=>$post_ids, ‘post_type’=>get_post_types() )
    );

    $blog = new avia_post_slider($atts);
    $blog->query_entries();
    echo “<div class=’entry-content’>”.$blog->html().”</div>”;
    }

    Here is the initial code that I replaced.

    if(!empty($_GET[‘s’]))
    {
    echo “<h4 class=’extra-mini-title widgettitle’>{$results}</h4>”;

    /* Run the loop to output the posts.
    * If you want to overload this in a child theme then include a file
    * called loop-search.php and that will be used instead.
    */
    $more = 0;
    get_template_part( ‘includes/loop’, ‘search’ );

    }

    #1139296

    Hi,

    Thank you for the update.

    We don’t really see the issue in the search results page. Nothing is displayed when we search for the keyword “Dog”.

    Search results for: Dog
    No Results Found For Dog

    Which part of the page are you trying get rid of?

    Best regards,
    Ismael

    #1139577

    Hi Ismael,

    Thanks for your email.
    I added some code and fixed it.
    that’s why you can see these results.
    Everything is working properly now.

    Thanks

    #1139585

    Hi,

    I’m glad this was resolved. If you need additional help, please let us know here in the forums.

    Best regards,
    Jordan Shannon

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

The topic ‘Issue with search that match no results’ is closed to new replies.