Forums › Forums › Search & Filter Pro › Show results in grid
- This topic has 30 replies, 2 voices, and was last updated 8 years, 1 month ago by Trevor.
-
Trevor(Private) October 15, 2016 at 10:02 am #64173
OK. This is the complete, revised results.php:
<?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> <div class="gp-blog-wrapper gp-blog-columns-3"> <div class="gp-inner-loop ajax-loop"> <?php while ($query->have_posts()) { $query->the_post(); ?> <section class="gp-post-item post-<?php get_the_id();?> post type-post format-standard has-post-thumbnail category-post-formats" itemscope="" itemtype="http://schema.org/Blog"> <div class="gp-post-thumbnail gp-loop-featured"> <div class="gp-image-above"> <a href="<?php the_permalink(); ?>"> <?php if ( has_post_thumbnail() ) { the_post_thumbnail("small", array('class' => 'gp-post-image gp-large-image')); the_post_thumbnail("thumb", array('class' => 'gp-post-image gp-mobile-image')); } ?> </a> </div> </div> <div class="gp-loop-content gp-image-above"> <h2 class="gp-loop-title"><a href="<?php the_permalink(); ?>"><?php the_title(); ?></a></h2> <div class="gp-loop-text"> <?php the_excerpt(); ?> </div> </div> <div class="gp-loop-meta"> <span class="gp-post-meta gp-meta-author"> <?php the_author_link(); ?> </span> <time class="gp-post-meta gp-meta-date" datetime="<?php the_date();?>"> <?php the_date(); ?> </time> </div> </section> <?php } ?> </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( '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"; } ?>
The posts all need featured images, many do not have them. It would also be a good idea to make manual excerpts for them all, as your theme seems to leave the excerpt very long 🙁
Anonymous(Private) October 15, 2016 at 3:09 pm #64218Trevor Hello and thank you for your code.
You can see the result here:
http://www.filmspourenfants.net/v2/films/Is approached;)
Can you help me get this result:
http://www.filmspourenfants.net/v2/hubs/films/To summarize :
– I do not want the name of the author
– I do not want the date
– I do not want the excerptHowever, At present, the resulting output page provides all the pages of the website.
– I only want the pages belonging to certain “Hub Categories”.Is it posible?
– I would like the name of the “Hub Categories” is displayed below the thumbnail
(eg: A partir de 9 ans”) as on the last link.Thank you very much.
Trevor(Private) October 17, 2016 at 10:38 am #64376In the form setup, across the top are some tabs. Look for the one for Tags and Categories and include the Hub Categories that you want.
The new 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> <div class="gp-blog-wrapper gp-blog-columns-3"> <div class="gp-inner-loop ajax-loop"> <?php while ($query->have_posts()) { $query->the_post(); ?> <section class="gp-post-item post-<?php get_the_id();?> post type-post format-standard has-post-thumbnail category-post-formats" itemscope="" itemtype="http://schema.org/Blog"> <div class="gp-post-thumbnail gp-loop-featured"> <div class="gp-image-above"> <a href="<?php the_permalink(); ?>"> <?php if ( has_post_thumbnail() ) { the_post_thumbnail("small", array('class' => 'gp-post-image gp-large-image')); the_post_thumbnail("thumb", array('class' => 'gp-post-image gp-mobile-image')); } ?> </a> </div> </div> <div class="gp-loop-content gp-image-above"> <h2 class="gp-loop-title"><a href="<?php the_permalink(); ?>"><?php the_title(); ?></a></h2> <div class="gp-loop-cats"> <?php echo get_the_term_list( get_the_id(), 'gp_hubs', '', ' ', '' ); ?> </div> </div> </section> <?php } ?> </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( '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) October 17, 2016 at 10:59 am #64405Hello Trevor,
I first did what you tell me about the tabs “Tags and Categories”.
It’s work very well.Then I replace the code of results.php by the new one you gave me,
see the result : http://www.filmspourenfants.net/v2/films/– The search form on the left disapear (Reminder I use Visual Composer to create my page. Both shortcodes appear on the same page. Should I use a widget to the sidebar?)
– The result say “Found 4 Results” but only one appears.
– Good for the excerpt, the date and the Author, but the Hub Category do not appear.
Thanks.
-
AuthorPosts