Forums › Forums › Search & Filter Pro › Results Template using multiple PODS (custom post types)
Tagged: templates results PODS
- This topic has 8 replies, 2 voices, and was last updated 6 years, 8 months ago by Anonymous.
-
Anonymous(Private) March 1, 2018 at 5:44 pm #163096
Hi , I use S&F to filter my PODS (custom posts) and it works great. I want to use S&F to give results for more than one custom post type at a time. In the example below I use it to show results in the Promotions POD, but I would prefer the results to include ‘Promotions’ AND ‘Posts’. I think it has something to do with WP Query but a bit lost how to edit this to work. Any ideas? Thanks …
<?php global $post; $pod_name = 'Promotions'; //get pods object $pods = pods( $pod_name, $post->ID ); echo $pods->template("my_search_loop"); ?>
Anonymous(Private) March 1, 2018 at 5:45 pm #163097The full results code… `<?php
/**
* Search & Filter Pro
*
* Sample Results Template
*
* @package Search_Filter
* @author Ross Morsali
* @link http://www.designsandcode.com/
* @copyright 2015 Designs & Code
*
* Note: these templates are not full page templates, rather
* just an encaspulation of the your results loop which should
* be inserted in to other pages by using a shortcode – think
* of it as a template part
*
* This template is an absolute base example showing you what
* you can do, for more customisation see the WordPress docs
* and using template tags –
*
* http://codex.wordpress.org/Template_Tags
*
*/if ( $query->have_posts() )
{
?>Found <?php echo $query->found_posts; ?> Results<br />
Page <?php echo $query->query[‘paged’]; ?> of <?php echo $query->max_num_pages; ?><br /><div class=”pagination”>
<div class=”nav-previous”><?php next_posts_link( ‘Older posts’, $query->max_num_pages ); ?></div>
<div class=”nav-next”><?php previous_posts_link( ‘Newer posts’ ); ?></div>
<?php
/* example code for using the wp_pagenavi plugin */
if (function_exists(‘wp_pagenavi’))
{
echo “<br />”;
wp_pagenavi( array( ‘query’ => $query ) );
}
?>
</div><?php
while ($query->have_posts())
{
$query->the_post();?>
<div class=”results-inline-search”>
<?php
global $post;
$pod_name = ‘Promotions’;
//get pods object
$pods = pods( $pod_name, $post->ID );echo $pods->template(“my_search_loop”);
?>
</div>
<?php
}
?>
<br />Page <?php echo $query->query[‘paged’]; ?> of <?php echo $query->max_num_pages; ?><br /><div class=”pagination”>
<div class=”nav-previous”><?php next_posts_link( ‘Older posts’, $query->max_num_pages ); ?></div>
<div class=”nav-next”><?php previous_posts_link( ‘Newer posts’ ); ?></div>
<?php
/* example code for using the wp_pagenavi plugin */
if (function_exists(‘wp_pagenavi’))
{
echo “<br />”;
wp_pagenavi( array( ‘query’ => $query ) );
}
?>
</div>
<?php
}
else
{
echo “No Results Found”;
}
?>`Anonymous(Private) March 1, 2018 at 6:08 pm #163112I set it up originally to reference the Promotions post type. which works great. I then wanted to add ‘posts’ to the results. The posts are found in the results list. I can see that by the number of results returned in each search request, however the posts are not displayed at all as the template to display the results is not looking for ;Posts’, just ‘Promotions’.
I hope that makes sense?
Thanks -
AuthorPosts