Search results on blog sidebar show blocks

This topic has 11 replies, 3 voices, and was last updated 2 years, 3 months ago ago by Olga Barlow

  • Avatar: Niddy
    Niddy
    Participant
    March 27, 2022 at 14:55

    Hi

    When you use the WordPress search, sidebar block so on blog page to search posts (not the Xstore theme advanced search in the header) it is showing results of the emails used in email builder. ie New order email / registration email etc.

    Can we hide these results as they should never be visible on the front end.

    Thanks

    10 Answers
    Avatar: Rose Tyler
    Rose Tyler
    Support staff
    March 27, 2022 at 14:57

    Hello,

    Please provide URL and screenshots for a better understanding of your request.

    Regards

    Avatar: Niddy
    Niddy
    Participant
    March 27, 2022 at 15:08

    Hi

    I can’t show my site until tmw now. But basically when you activate the email builder to use custom emails – go to a blog post. Any that has the sidebar search.

    https://xstore.8theme.com/elementor/maecenas-parturient-duis-mus-fames/

    Then search for “order” or something in the email like “site_email” etc.

    These emails from the builder show in search results. But only the sidebar WordPress one. Not the shop one in the header.

    Avatar: Rose Tyler
    Rose Tyler
    Support staff
    March 28, 2022 at 06:54

    Hello,

    Thanks for the reply. I’ve passed this question to our dev team.

    Regards

    Avatar: Niddy
    Niddy
    Participant
    March 28, 2022 at 09:47

    Hiya

    See private info for working example of what I mean…..

    Any thoughts on how to hide these….? It’s really urgent as we cannot go live with this huge error. Please urgently advise.

    Regards hiding testimonials, do you think this would work as a function? And if so can we also edit to hide the email blocks?

    ===========================
    add_action( ‘init’, ‘exclude_testimonials_from_search’, 99 );
    function exclude_testimonials_from_search() {
    global $wp_post_types;
    if ( post_type_exists( ‘wpm-testimonial’ ) ) {
    // exclude from search results
    $wp_post_types[‘wpm-testimonial’]->exclude_from_search = true;
    }
    }
    ===========================

    Or This – can hide testimonials etc but not the customizer emails… I have decided to install this instead of the snippet above because I can control all the other static blocks that are showing up –> https://wordpress.org/plugins/mpress-hide-from-search/

    Please contact administrator
    for this information.
    Avatar: Niddy
    Niddy
    Participant
    March 28, 2022 at 13:34

    Hi

    Additionally, is it possible to hide the page featured image in main product search but keep the product images there?

    See private info for this query – thanks.

    Please contact administrator
    for this information.
    Avatar: Rose Tyler
    Rose Tyler
    Support staff
    March 28, 2022 at 15:28

    Hello,

    1/ We excluded a few post types as you asked from the default WordPress search (404 page or search from sidebar widget ) by adding the next code in your child-theme/functions.php

    add_action( 'init', 'etheme_exclude_post_types_in_search', 99 );
    function etheme_exclude_post_types_in_search() {
    global $wp_post_types;
    if ( post_type_exists( 'viwec_template' ) ) {
    $wp_post_types['viwec_template']->exclude_from_search = true;
    }
    if ( post_type_exists('testimonials') ) {
    $wp_post_types['testimonials']->exclude_from_search = true;
    }
    }



    2/ We fixed the issue about page featured image in full width search globally in
    et-core-plugin/app/models/customizer/class-ajax-search.php
    on 405 line 
’img’ => (isset($this->request[‘full_screen’]) && $post->post_type == ‘page’) ? false : get_the_post_thumbnail_url( $post->ID, ‘medium’ ),
    Also this fix will be included in next theme update

    Regards

    Avatar: Niddy
    Niddy
    Participant
    March 28, 2022 at 16:03

    Amazing thank you very much – perfect! Glad I done video’s now as it made it easier to explain lol – but thanks; great job – perfect!

    One last query regards this – the function you added, can you confirm if the one above it (or similar) will be ok to hide the testimonials on search results page as we don’t want to see those – or, is there a way we can design the actual testimonials page to add a sidebar or something to help it look right?

    Please clarify – thanks again, awesome job. Top support.

    Please contact administrator
    for this information.
    Avatar: Niddy
    Niddy
    Participant
    March 28, 2022 at 16:24

    Sorry – added private data in post above as issues are still there after saving 🙁

    Sorry

    Avatar: Niddy
    Niddy
    Participant
    March 29, 2022 at 11:13

    Hi

    Might have been a cache issue as seems ok now – please leave open in case and I will test this over the coming days.

    Thanks again for awesome help & support. 🙂

    Avatar: Olga Barlow
    Olga Barlow
    Support staff
    March 29, 2022 at 11:16

    Hello,

    You are welcome! Feel free to ask if you need help.

    Regards

  • Viewing 11 results - 1 through 11 (of 11 total)

You must be logged in to reply to this topic.Log in/Sign up

We're using our own and third-party cookies to improve your experience and our website. Keep on browsing to accept our cookie policy.