Home Forums WoodMart support forum add page or all post_types to search

add page or all post_types to search

Viewing 7 posts - 1 through 7 (of 7 total)
  • Author
    Posts
  • #320764

    florianibe
    Participant

    Hi Xtemos-team,

    we use our themes since basel a lot of times and we love it and be a really good affiliate in Germany BUT one thing is totally frustrating and we send it to you some time.

    Please add the page post_type to header builder search element AND a button 2all post types”.

    After every update we need to make manually this steps below and i think its 15 minutes of development to add it on next woodmart update to the standard features.

    https://xtemos.com/forums/topic/relevansi-plugin-ajax-search-for-everyone/page/2/

    So 1st go to:

    /wp-content/themes/woodmart/inc/builder/elements/Search.php

    and delete the following code from line 119 to 140

    ‘post_type’ => array(
    ‘id’ => ‘post_type’,
    ‘title’ => esc_html__( ‘Post type’, ‘woodmart’ ),
    ‘type’ => ‘selector’,
    ‘tab’ => esc_html__( ‘General’, ‘woodmart’ ),
    ‘value’ => ‘product’,
    ‘options’ => array(
    ‘product’ => array(
    ‘value’ => ‘product’,
    ‘label’ => esc_html__( ‘Product’, ‘woodmart’ ),
    ),
    ‘post’ => array(
    ‘value’ => ‘post’,
    ‘label’ => esc_html__( ‘Post’, ‘woodmart’ ),
    ),
    ‘portfolio’ => array(
    ‘value’ => ‘portfolio’,
    ‘label’ => esc_html__( ‘Portfolio’, ‘woodmart’ ),
    ),
    ),
    ‘description’ => esc_html__( ‘You can set up the search for posts, projects or for products (woocommerce).’, ‘woodmart’ ),
    ),

    2nd go to:

    /wp-content/themes/woodmart/inc/modules/search.php

    In line 293 replace the

    $allowed_types = array( ‘post’, ‘product’, ‘portfolio’ );
    $post_type = array(‘page’, ‘post’, ‘product’);

    with this code

    $allowed_types = array( ‘page’, ‘post’, ‘product’, ‘portfolio’ );
    $post_type = array(‘page’, ‘post’, ‘product’);
    or
    $allowed_types = array( ‘page’, ‘post’, ‘product’, ‘portfolio’ );
    $post_type = array(‘page’, ‘post’, ‘product’, ‘portfolio’);

    After that go to your header builder. Open your header go to the search widget click edit save and lastly save header.

    Clear cache and go make a search.

    HOPE YOU WOULD ADD IT TO MAKE A LOT OF PEOPLE HAPPY =)

    Florian

    #320776

    Artem Temos
    Keymaster

    Hello,

    When you remove the post_type from the arguments list it displays all pages, posts, projects, and posts as blog posts. Is it the way it should work?

    Kind Regards

    #320780

    florianibe
    Participant

    The solution is the tutorial with 2 steps i posted on the top of this topic.
    Its works perfectly but i want to ask and inform you that it should be a standard function on the woodmart theme and the header builder. 😉

    #320782

    Artem Temos
    Keymaster

    But it looks like this when it searches for all post types https://prnt.sc/1tfy3as
    It is not a good way to present results for most online stores.

    #320786

    florianibe
    Participant

    You are right, but woodmart is not only nice for shops 😉
    You sould only add another button in search element in header builder for post type “page” and “all post types”.

    #320787

    Artem Temos
    Keymaster

    OK, we will add two more options for this in our next update 🙂

    #329700

    IPWEANZ
    Participant

    I’d like to echo the need for “Post” and “All post types” in the search settings. It would be immensely helpful.

    Florian, thanks for posting the code above 🙂

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