Jump to content
Sign in to follow this  
hireconrad

Search Results Not Working for Banner Content

Recommended Posts

hireconrad

Hi, i was testing out my in-progress website and i noticed that when i search a word I've used in the banner in the search bar, nothing is found. How can i fix this?

Share this post


Link to post
Share on other sites
Danny

Hi, I apologise but I don't quite understand what you're asking. Are you suggesting you want text that has been added to the banner section, to show up in search results ?


Please search our forums, before posting!

Share this post


Link to post
Share on other sites
hireconrad

@Danny, yes. Since most of my site contents will be present in the Banners, i need the search function to search their as well.

Share this post


Link to post
Share on other sites
Simon

Wordpress search only searches post and page content. Banners/featues/boxes are all custom post types. If you want to all these to search you will need tell WordPress to add them into the search query. There are plugins to do this or snippets of custom code, example first google result: http://wordpress.org/support/topic/how-to-include-custom-post-types-in-search-results-and-archives

Share this post


Link to post
Share on other sites
hireconrad

where and how do I add custom php code ( i have never meddled with php before? what would the custom post type for boxes and banners be? On the link that @simon provided, the following php code was suggested: functions.php file: function filter_search($query) { if ($query->is_search) { $query->set('post_type', array('post', 'folio')); }; return $query; }; add_filter('pre_get_posts', 'filter_search');

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this  

×