Forums Forums Search & Filter Pro Show results in grid

Viewing 10 posts - 21 through 30 (of 31 total)
  • Trevor
    #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
    #64218

    Trevor 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 excerpt

    However, 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
    #64376

    In 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
    #64405

    Hello 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.

    Trevor
    #64412
    This reply has been marked as private.
    Anonymous
    #64419
    This reply has been marked as private.
    Trevor
    #64460

    Is that OK now? I did not know the correct name of the category slug for hubs. It was not hubs it was gp_hubs 🙁

    Anonymous
    #64498

    Great you’re the best !

    Thank you for the code of results.php file, I would never have found alone.

    I changed the number of columns. The result is now perfect!

    How to thank you?

    Trevor
    #64545
    This reply has been marked as private.
    Anonymous
    #65294
    This reply has been marked as private.
Viewing 10 posts - 21 through 30 (of 31 total)