![Check out Enfold](https://kriesi.at/wp-content/themes/kriesi/images/banner-enfold.jpg)
Tagged: pages, posts, products, search, woocommerce
-
AuthorPosts
-
October 17, 2019 at 9:25 am #1148836
Hi Guys,
Good morning!
I was looking for a solution to get solve this issue of get the search bring as results, products,sku, pages and posts.
In the forum I found this post “Improved search for Woo Commerce” and I’ve implemented in the code, but it doesnt work for me, because it brings as result only products and SKU’s, pages and posts don’t.Could you please give me a help to set it up?
Thanks in advance!
Regards,
Eduardo.October 20, 2019 at 11:36 am #1149596Hey EduardoPriuli,
Can you give us temporary admin access to your website in the private content box below, so that we can have a closer look?
Best regards,
VictoriaOctober 29, 2019 at 5:37 pm #1152105Hi Victoria,
Sure.
Please find in the private content the credentials to access the site.
I’m looking forward to hearing back from you.Thanks,
November 5, 2019 at 12:25 pm #1153972Hello Victoria,
Good Morning!
I didn’t hear about you. Did you get any update about the issue I’m facing in?
Im looking forward to hear from you soon.
Thanks in advance,
Cheers,
Eduardo.November 5, 2019 at 7:25 pm #1154057Hi,
Please Install he plugin called ” Search Everything ” and let us know if this shorts the issue for you.
Best regards,
BasilisNovember 6, 2019 at 1:43 pm #1154287Hi Basilis,
I’ve tried with two different plugins, “Search Everything” and also “Ivory Search”, but it didn’t work.
Do you have any other suggestion?I just wanna make the “search” brings post, pages and also products in the results.
Looking for your reply.
Thanks in advance.
Eduardo.November 8, 2019 at 11:26 am #1154922Hi there,
Is there anyone that could help me with this issue??
I’m looking forward to hearing from you guys.
Thanks in advance!
November 10, 2019 at 6:37 pm #1155369Hi,
Give us a link of your web site and some keywords you tried ( where they exist as a product also ) so we can understand what is going on and how we can implement it further please.
Best regards,
BasilisNovember 11, 2019 at 2:05 pm #1155607Hi Basilis,
Please find the requested information in the Private content area.
I put the site link, the Product Page (woocommerce) and also regular page, I’d like the search brings both pages in the search result page.I’ll be looking for your assistance.
Regards,
EduardoNovember 13, 2019 at 8:45 pm #1156500Hi,
I tried for Bravo and here are the results
https://www.tcr-tecora.com/en/?s=Bravo+Basicnot sure why you say that they are not visible?
Best regards,
BasilisNovember 14, 2019 at 10:07 am #1156690Hello Basilis,
Good morning!
Sorry, maybe I wasn’t clear enough explaining myself.
The Post Title is: Search Products, Pages and Posts.
I have pages and products with the same titles, like: BRAVO BASIC. So, I would like the search brings all results Pages, Products and Posts.
The link for the Product information page is: https://www.tcr-tecora.com/en/outdoor-air-quality/bravo-basic/
and the Product (woocommerce) Page is: https://www.tcr-tecora.com/en/product/bravo-basic/
bur the Keyword is always the same: Bravo Basic.The problem is, the search result show me only the Product Information Page and not the Product (Woocommerce) Page.
I hope this time get explain it better. Once again I’m sorry.
I’ll be looking for your assistance.
Thanks
Eduardo.November 18, 2019 at 5:02 pm #1157915Hi Basilis,
Good Afternoon,
I’m still waiting for your support, how long I’ll need to wait to hear from you guys?I think it shouldn’t be a tough issue for you, 5 dedicated minutes could be enough to solve this issue.
I’m looking to hearing from you soon.
Thank you.
November 19, 2019 at 4:07 am #1158002Hi,
Sorry for the delay. You can add the following filter in the functions.php file to make the items with the product post type searchable.
function avf_enable_cpt_search( $query ) { if ( $query->is_search ) { $query->set( 'post_type', array( 'post', 'attachment', 'product', 'portfolio', 'page' ) ); $query->set( 'post_status', array( 'publish', 'inherit' ) ); } return $query; } add_filter( 'pre_get_posts', 'avf_enable_cpt_search' );
Please make sure that the previous search plugins that you installed are deactivated before testing the changes.
Best regards,
IsmaelNovember 28, 2019 at 7:01 pm #1161091Hi Ismael,
I have tried to implement the code but it returns the following error:
Your PHP code changes were rolled back due to an error on line 0 of file Unknown. Please fix and try saving again.
Exception thrown without a stack frameI’ll be looking for your reply.
Thanks in advance.
November 29, 2019 at 11:17 am #1161182Hi,
Thank you for the update.
Did you copy the code from your email? Please try to copy it directly from the forum to prevent unwanted text conversion. Let us know if it still doesn’t work then.
Best regards,
IsmaelDecember 4, 2019 at 1:11 pm #1162563Hi Ismael,
I’m sad to say it didn’t work.
Any other idea? It shouldn’t be a big deal….Look to hearing from you.
Cheers,
December 5, 2019 at 10:42 am #1162870Hi,
Thank you for the update.
We added the code in the functions.php file. The search is now displaying items from all available post types including products. (see private field)
Best regards,
IsmaelDecember 5, 2019 at 11:53 am #1162899Hi Ismael,
Ok now it’s working fine! Thanks a lot!
Regards,
Priuli
-
This reply was modified 4 years, 9 months ago by
Priuli.
December 5, 2019 at 6:58 pm #1163122Hi,
Did you need additional help with this topic or shall we close?
Best regards,
Jordan ShannonApril 25, 2023 at 11:27 am #1405496long time ago – and your code here on https://kriesi.at/support/topic/search-products-pages-and-posts-enfold/#post-1158002
i use too and posted it here – because i did not found it via search function.But now i got one problem – how to show the search results page as grid – if attachments are also listed. The known changes in search.php do not work with attachments – and even if i change the custom-query there too – no effort.
I have already asked Günter – but I do not want to overuse his friendliness and accommodation. Maybe you have an idea what it could be.April 26, 2023 at 12:55 pm #1405696Hi,
I made the following modifications to your core theme files:
search.php (line 55):
global $wp_query; $atts = array( 'type' => 'grid', // 'post_type' => [ 'attachment' ], 'items' => get_option('posts_per_page'), 'columns' => 3, 'class' => 'avia-builder-el-no-sibling', 'paginate' => 'yes', 'use_main_query_pagination' => 'yes', 'wp_query' => $wp_query ); /** * @since 4.5.5 * @return array */ $atts = apply_filters( 'avf_post_slider_args', $atts, 'search' ); $blog = new avia_post_slider( $atts ); // $blog->query_entries(); echo '<div class="entry-content-wrapper">' . $blog->html() . '</div>';
enfold\config-templatebuilder\avia-shortcodes\postslider\postslider.php (line 566):
$this->entries = isset( $atts['wp_query'] ) && $atts['wp_query'] instanceof WP_Query ? $atts['wp_query'] : array();
and to custom.css:
.template-search .post-entry{ clear: unset; }
Can you have a look at it please.
Best regards,
GünterApril 26, 2023 at 3:50 pm #1405710Hi,
Solution will be in 5.6.
Use filter ‘avf_search_result_layout’ and return ‘grid’.
Above changes to custom.css are no longer necessary.
Best regards,
GünterApril 26, 2023 at 8:03 pm #1405745Thank you for finding/creating a solution for this. This is a good thing for photographers and sites that display art objects (paintings, sculptures, etc.), as most search results only contain links to attachment pages (photos or other media files).
April 29, 2023 at 9:13 pm #1406018 -
This reply was modified 4 years, 9 months ago by
-
AuthorPosts
- The topic ‘Search products, pages and posts [ENFOLD]’ is closed to new replies.