Hello, I am working on a site with several post types - 4 to be exact - and I am trying to setup the search results page to have a filter/sort the results by post types.
For example, when a person searches a term they are taken to the page with the results, all posts found from all post types are shown but up top there are the different post types name links that will sort the results and show only the respective post type's post. Right now I have several loops on the search results page for each post type and the main ( show all results ) loop but when I test it, the loops are all showing the the correct post types but not the correct search term results. Only the main (default wordpress) loop is showing the correct search results.
My loops for my custom post types look like this - `<?php global $post; $args=array(
'post_type' => 'videos',
'post_status' => 'publish',
); $myposts = get_posts($args); foreach( $myposts as $post ) : setup_postdata($post); ?>
// MY DIVS AND CONTENT
What can I do so that all the loops use the same search term and return the correct posts for each post type??
Any help would be greatly appreciated. Thanks.