Forums › Forums › Search & Filter Pro › Filter on Thrive Theme Builder post grid
- This topic has 7 replies, 2 voices, and was last updated 8 years, 7 months ago by Trevor.
-
Anonymous(Private) May 19, 2016 at 12:12 am #45972
I’m using Thrive Themes for my WordPress theme. Inside a page where I have classic Corvettes listed for sale, I’d like to set up a searchandfilter on only the Corvettes listed there. I have many other types of cars…I just want the filter to be on the Corvettes on this page only.
For example, I want them to be able to search by year, exterior color, only on the corvettes shown on this page: http://www.collectorsector.com/classic-corvettes-for-sale
How can I do this?
Trevor(Private) May 19, 2016 at 10:19 am #45991I would need to know a little about your site structure (in the admin).
Do you have a Custom Post Type for Corvettes or for Autos in General?
How is the make of the auto stored (taxonomy or custom field)?
How is the model of the auto stored (taxonomy [same as make or different?] or custom field)?
Trevor(Private) May 20, 2016 at 3:13 pm #46150Got the files. I will post the results.php here for others to use if they wish, with their copy of Ignition and Thrive Visual Builder:
<?php /** * Search & Filter Pro * * Sample Thrive Results Template * * @package Search_Filter * @author Trevor Nelmes * @link http://www.designsandcode.com/ * @copyright 2016 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; ?> Cars<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( 'Previous Page of Cars', $query->max_num_pages ); ?></div> <div class="nav-next"><?php previous_posts_link( 'Next Page of Cars' ); ?></div> <?php /* example code for using the wp_pagenavi plugin */ if (function_exists('wp_pagenavi')) { echo "<br />"; wp_pagenavi( array( 'query' => $query ) ); } ?> </div> <div class="thrv_wrapper thrv_post_grid" data-unit="px"> <div class="tve_post_grid_wrapper tve_clearfix tve_post_grid_grid"> <div style="display: flex; flex-wrap: wrap;" class="tve_pg_row tve_clearfix"> <?php $thrive_counter = 0; $thrive_row_counter = 0; while ($query->have_posts()) { if ( $thrive_counter == 0 ) && ( $thrive_row_counter > 0 ) { ?> </div> <div style="display: flex; flex-wrap: wrap;" class="tve_pg_row tve_clearfix"> <?php } $query->the_post(); ?> <div class="tve_post tve_post_width_5 " style="align-items: stretch;"> <div class="tve_pg_container"> <?php if ( has_post_thumbnail() ) { $thrive_image = wp_get_attachment_image_src( get_post_thumbnail_id(), 'single-post-thumbnail' ); ?> <a href="<?php the_permalink(); ?>"> <div class="tve_post_grid_image_wrapper" style="background-image: url('<?php echo $thrive_image[0]; ?>')"> <div class="tve_pg_img_overlay"> <span class="thrv-icon thrv-icon-forward"></span> </div> </div> </a> <?php } ?> <span class="tve-post-grid-title " style="font-size: 18px;line-height: 20px;font-family:'Arial', 'Helvetica', 'sans-serif';"> <a href="<?php the_permalink(); ?>"><?php the_title(); ?></a> </span> <div class="tve_pg_more" data-tve-custom-colour="62938813"> <a href="<?php the_permalink(); ?>">View Now</a> <span class="thrv-icon thrv-icon-uniE602"></span> </div> </div> </div> <?php $thrive_counter++; if ( $thrive_counter > 4 ) { $thrive_counter = 0; $thrive_row_counter++; } } ?> </div> </div> </div> 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( 'Previous Page of Cars', $query->max_num_pages ); ?></div> <div class="nav-next"><?php previous_posts_link( 'Next Page of Cars' ); ?></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"; } ?>
Note that this search was for Cars for Sale, so some text strings have been modified to suit (like in the number of results and pagination).
-
AuthorPosts