Posted: August 26, 2017 at 12:00 am
Hi! Try keywords yoga, spanish, duck, fire…nothing found. |
|
You may need to add some code like this to your site: http://www.remicorson.com/include-all-your-wordpress-custom-post-types-in-search/ You can add the above to a functions plugin or into your WordPress theme’s functions.php file. |
|
I’ve added this code to the bottom of the eduma functions.php file, and still no results: function rc_add_cpts_to_search($query) { // Check to verify it’s search page |
|
Can you check to see if there are any other functions that hook in to pre_get_posts, either from the theme or another plugin? There may be some code that’s resetting the search query. You can also follow these steps to rule out a plugin/theme conflict: |
|
Hi! |
|
So the search still didn’t return event posts with all other plugins deactivated and with the default theme activated? Is the hosting plan on Godaddy managedWP? If so has caching been disabled? |
|
Hi Josh! I tried this code in functions.php for the theme, but no luck:
Anything I could ask the theme developers to focus on? |
|
I have an older version of Eduma but it doesn’t have the above action within it so I’m not sure what the above is trying to do as I can’t see any of that code. However I did take a look at the version of Eduma I have and it has a if ( $query->is_search ) { if ( empty( $_REQUEST['post_type'] ) ) { $query->set( 'post_type', array( 'post', 'page' ) ); } $query->set( 'post_status', array( 'publish' ) ); wp_reset_query(); } That’s the problem as EE events are posts with a post_type of ‘espresso_events’, they aren’t included in the above. You can add something like this: https://gist.github.com/Pebblo/d1780fee1ce28e98fcd5eed01241a8d9 To a Custom Functions Plugin on your site to include EE events and venues within the earch (remove ‘espresso_venues’ from the code if you don’t want to include Venues). I don’t think it’s a good idea for the theme to specifically set the posts types it should search. That basically removes support for searching any custom post types without setting that post type in the code above again so you may want to create a ticket with Edmua for to fix this in the theme. If the above does not fix the search it may be something different in a newer version, if you can send me a copy I’ll take a look and see whats changed. |
|
Hi Tony, Are you saying I look in functions.php? I’m not seeing your code in: |
|
I’m not sure what you mean, are you looking for my custom code within your theme? If so you’re not going to find it. To fix your problem you need to create a custom functions plugin on your site by following the guide I linked to above: https://eventespresso.com/wiki/create-site-specific-plugin-wordpress-site/ Then add the custom code I created to that plugin: https://gist.github.com/Pebblo/d1780fee1ce28e98fcd5eed01241a8d9 That function adds the EE events and EE venues to the post types that your site will search when using the search function. It does that after your theme has ‘done its thing’ that is breaking the search so you don’t need to alter the theme itself. If you want to take a look at the function that is causing the problem, on my version of Eduma it is within |
|
Thank you!
Thank you for the help! |
|
Hmm strange, it works fine in a plugin for me. Either way, I’m glad it’s working for you. |
|
The support post ‘EE4 search’ is closed to new replies.
Have a question about this support post? Create a new support post in our support forums and include a link to this existing support post so we can help you.