Home › Forums › WoodMart support forum › add page or all post_types to search
add page or all post_types to search
- This topic has 6 replies, 3 voices, and was last updated 2 years, 10 months ago by IPWEANZ.
-
AuthorPosts
-
September 24, 2021 at 8:53 am #320764
florianibeParticipantHi 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
September 24, 2021 at 9:27 am #320776
Artem TemosKeymasterHello,
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
September 24, 2021 at 9:34 am #320780
florianibeParticipantThe 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. 😉September 24, 2021 at 9:36 am #320782
Artem TemosKeymasterBut 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.September 24, 2021 at 9:49 am #320786
florianibeParticipantYou 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”.September 24, 2021 at 9:54 am #320787
Artem TemosKeymasterOK, we will add two more options for this in our next update 🙂
November 4, 2021 at 10:56 pm #329700
IPWEANZParticipantI’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 🙂
-
AuthorPosts
- You must be logged in to create new topics. Login / Register