Navigation
This is archived content. Visit our new forum.

Tagged: 

  • Author
    Posts
  • #1360947
    Exord B.V.
    Participant

    Hi there!

    The search function for the entire website is not working with essential grid articles.

    http://www.thegreenhapiness.com

    Could you please help me?

    thanks!

    #1360948
    Exord B.V.
    Participant

    Oh and I’m fully updated 🙂

    #1361014
    Lely
    Moderator

    Hello Rianne,

    Your site is not loading when I checked. See attached screenshot.

    #1368630
    Exord B.V.
    Participant

    hmmm…
    can you try again??

    #1368651
    Christian
    Moderator

    Another support member here and your site doesn’t load on my end too (see attachment)

    #1370287
    Exord B.V.
    Participant

    Hmm.. that’s strange! I’m going figure this out

    #1370292
    Exord B.V.
    Participant

    Ah… i’m so stupid

    The link is: http://www.thegreenhappiness.com

    I’m sorry!

    #1370358
    Lely
    Moderator

    Hi There,

    Please add the following code on your child theme’s functions.php file.

    // add custom types to archive
    function search_add_custom_types( $query ) {
      if( is_search() ) {
        $query->set( 'post_type', array(
          'post', 'essential_grid'
        ));
      return $query;
      }
    }
    add_filter( 'pre_get_posts', 'search_add_custom_types' );

    Hope this helps.

    #1370481
    Exord B.V.
    Participant

    thanks that worked!

    #1370537
    Rahul
    Moderator

    Glad we were able to help you.

    Let us know if we can help with anything else.

    Thanks for choosing the X-theme.

    #1371650
    Exord B.V.
    Participant

    New problem…
    When I use the code from Lely the search function in admin @ WooCommerce is not working anymore… I get a message that I don’t have permission from WordPress to view the search results

    #1371751
    Lely
    Moderator

    Hi There,

    Try updating the code to this:

    // add custom types to archive
    function search_add_custom_types( $query ) {
      if( is_search() && ! is_admin() ) {
        $query->set( 'post_type', array(
          'post', 'essential_grid'
        ));
      return $query;
      }
    }
    add_filter( 'pre_get_posts', 'search_add_custom_types' );

    Hope this helps.

    #1371928
    Exord B.V.
    Participant

    that worked 🙂

    #1372667
    Rad
    Moderator

    Glad to hear that!

  • <script> jQuery(function($){ $("#no-reply-1360947 .bbp-template-notice, .bbp-no-topic .bbp-template-notice").removeClass('bbp-template-notice'); }); </script>