Forums Forums Search Search Results for 'found_posts'

Viewing 10 results - 101 through 110 (of 174 total)
  • Author
    Search Results
  • #126083

    In reply to: Layout


    Trevor
    Participant

    This is the customised results.php to work in your child theme of the Primrose theme, making it look like the grid you made with SiteOrigin:

    <?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 id="sf-custom-results" class="panel-layout">
    	<?php
    	$result_counter=0;
    	$data_index=0;
    	while ($query->have_posts())
    	{
    		$query->the_post();
    		
    		?>
    		<div class="sf-results-row panel-grid panel-no-style">
    
    			<div class="sf-results-leftcol panel-grid-cell">
        <div class="so-panel widget widget_sow-image panel-first-child panel-last-child" data-index="<?php echo $data_index++;?>">
    					<div class="so-widget-sow-image so-widget-sow-image-default-eef982a7180b">
          <div class="sow-image-container">
    						<?php 
    							if ( has_post_thumbnail() ) {
    								the_post_thumbnail("full");
    							}
    						?>
    						</div>
    					</div>
        </div>
    			</div>
    
    			<div class="sf-results-rightcol panel-grid-cell">
    				<div class="so-panel widget widget_sow-editor panel-first-child panel-last-child" data-index="<?php echo $data_index++;?>">
    					<div class="so-widget-sow-editor so-widget-sow-editor-base">
    						<h3 class="widget-title"><?php the_title(); ?></h3>
    						<div class="siteorigin-widget-tinymce textwidget">
    							<header class="w2dc-listing-header"><p>blah</p></header>
    							<p><br /><?php the_excerpt(); ?></p>
    						</div>
    					</div>
    				</div>
    			</div>
    
    		</div>
    		
    		<?php
    			//$result_counter++;
    	}
    	?>
      </div>
      <div>Page <?php echo $query->query['paged']; ?> of <?php echo $query->max_num_pages; ?></div>
    	
    	<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";
    }
    ?>

    This is the Custom CSS that accompanies it:

    .sf-results-leftcol.panel-grid-cell {
        width: 25% !important;
        width: calc(25% - ( 0.750000001875 * 40px)) !important;
    }
    .sf-results-rightcol.panel-grid-cell {
        width: 75% !important;
        width: calc(75% - ( 0.249999998125 * 40px)) !important;
    }
    #sf-custom-results .so-panel {
        margin-bottom: 0;
    }
    #sf-custom-results div.sf-results-row:nth-last-child(2) {
        margin-bottom: 0;
    }
    #sf-custom-results .sf-results-row {
        -webkit-align-items: flex-start;
        align-items: flex-start;
        margin-bottom: 40px;
    }
    @media (max-width: 767px) {
        .sf-results-leftcol.panel-grid-cell,
        .sf-results-rightcol.panel-grid-cell {
            width: 100% !important;
        }
        .sf-results-row {
            -webkit-flex-direction: column;
            -ms-flex-direction: column;
            flex-direction: column;
        }
        .sf-results-row .sow-image-container {
            text-align: center;
        }
    }
    #122625

    Anonymous
    Inactive

    I can’t show you the page but this is the code

    <?php
    if ( $query->have_posts() ) {
    	echo '<div class="posts-wrapper">';
    
    		while ($query->have_posts())
    		{
    			$query->the_post();
    			get_template_part('templates/content', get_post_type() != 'post' ? get_post_type() : get_post_format());
    		}
    
    	echo '</div>';
    	?>
    	<nav class="pagination" style="display: none;">
    		<ul>
    			<li class="previous"><?php next_posts_link( 'Older posts', $query->max_num_pages ); ?></li>
    			<li><span>Page <?php echo $query->query['paged']; ?> of <?php echo $query->max_num_pages; ?> (<?php echo $query->found_posts; ?> results)</span></li>
    			<li class="next"><?php previous_posts_link( 'Newer posts' ); ?></li>
    		</ul>
    	</nav>
    	<?php
    } else {
    	echo '<p class="no-results">Sorry, we couldn\'t find any results to match your search. Please try broadening your search, or <a href="' . home_url() . '" title="Return to the homepage">returning to the homepage</a>.</p>';
    }
    ?>
    #118140

    In reply to: Visual Results?


    Trevor
    Participant

    BTW, this is the grid making results.php I used for your genesis theme:

    <?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
    	$odd_check = 1;
    	$first_check = 1;
    	
    	while ($query->have_posts())
    	{
    		$query->the_post();
    
    		if ( $odd_check == 1 ) {
    			$odd_class = " odd";
    		} else {
    			$odd_class = "";
    		}
    		if ( $first_check == 1 ) {
    			$first_class = " first";
    		} else {
    			$first_class = "";
    		}
    		?>
    		<article class="simple-grid one-third<?php echo $odd_class;?><?php echo $first_class;?> post-<?php echo get_the_ID();?> post type-post status-publish format-standard entry">
       <a href="<?php the_permalink(); ?>" class="alignnone">
       <?php the_post_thumbnail("small");?>
    			</a>
    			<header class="entry-header">
        <h2 class="entry-title"><a href="<?php the_permalink(); ?>"><?php the_title(); ?></a></h2>
       </header>
    		</article>
    
    		<?php
     	$odd_check++;
    		if ( $odd_check == 3 ) $odd_check = 1;
    	 $first_check++;
    		if ( $first_check == 4 ) $first_check = 1;
    
    	}
    	?>
    	<div style="clear: both;">
    		Page <?php echo $query->query['paged']; ?> of <?php echo $query->max_num_pages; ?>
    	</div>
    	
    	<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";
    }
    ?>
    #115150

    Trevor
    Participant
    #114400

    Anonymous
    Inactive

    Hi,
    Here is the results.php, but I have another for costumization.

    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>
    
    	<
    	? php
    	while ( $query->have_posts() ) {
    		$query->the_post();
    
    		?>
    		<div style="display: inline-block; width:50%;">
    			<?php 
    				if ( has_post_thumbnail() ) {
    					echo '<p>';
    					the_post_thumbnail("small");
    					echo '</p>';
    				}
    			?>
    		</div>
    		<div style="display: inline-block; width:50%;">
    			<h2><a href="<?php the_permalink(); ?>"><?php the_title(); ?></a></h2>
    			<p>
    				<?php the_category(); ?>
    			</p>
    			<p>
    				<?php the_tags(); ?>
    			</p>
    			<p>
    				<small>
    					<?php the_date(); ?>
    				</small>
    			</p>
    			<p><br/>
    				<?php the_excerpt(); ?>
    			</p>
    		</div>
    
    		<
    		/div>
    
    		<hr/>
    		<?php
    		}
    		?> 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";
    	}
    	?>
    

    2553.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() ) {
    	?>
    
    	<div style="float: left;">
    		<strong>
    			<?php echo $query->found_posts; ?>
    		</strong> resultado(s)</div>
    	<div style="float: right;">Pág.
    		<?php echo $query->query['paged']; ?> de
    		<?php echo $query->max_num_pages; ?>
    	</div>
    	<div style="clear: both;"></div>
    	<hr>
    
    	<div class="pagination" style="width: 100% !important;">
    
    		<div style="float: right;">
    			<?php next_posts_link( '<span class="ion-arrow-right-c"></span>', $query->max_num_pages ); ?> </div>
    		<div style="float: left;">
    			<?php previous_posts_link( '<span class="ion-arrow-left-c"></span>' ); ?>
    		</div>
    		<div style="clear: both;"></div>
    		<?php
    		/* example code for using the wp_pagenavi plugin */
    		if ( function_exists( 'wp_pagenavi' ) ) {
    			echo "<br />";
    			wp_pagenavi( array( 'query' => $query ) );
    		}
    		?>
    	</div>
    	<div style="clear: both;"></div>
    
    	<
    	? php
    	while ( $query->have_posts() ) {
    		$query->the_post();
    
    		?>
    
    		<div style="float: left; width: 50%;  padding-bottom: 50px;">
    			<?php 
    				if ( has_post_thumbnail() ) {
    					echo '<p>';
    					the_post_thumbnail("small");
    					echo '</p>';
    				}
    			?>
    		</div>
    
    		<div style="float: left; width: 50%; padding-left: 20px; padding-bottom: 50px;">
    
    			<h3><a href="<?php the_permalink(); ?>"><?php the_title(); ?></a></h3>
    			<p>
    				<?php echo do_shortcode('[pods field="resumo_objectivos"]'); ?>
    			</p>
    			<p>
    				<?php echo do_shortcode('[pods field="datas"]'); ?>
    			</p>
    			<p>
    				<?php echo do_shortcode('[pods field="preco"]'); ?>
    			</p>
    			<p>
    				<?php echo do_shortcode('[pods field="duracao"]'); ?>
    			</p>
    		</div>
    
    		<hr/>
    		<div style="clear: both;"></div> <
    		? php
    	}
    	?>
    
    	<div class="pagination" style="width: 100% !important;">
    
    		<div style="float: right;">
    			<?php next_posts_link( '<span class="ion-arrow-right-c"></span>', $query->max_num_pages ); ?> </div>
    		<div style="float: left;">
    			<?php previous_posts_link( '<span class="ion-arrow-left-c"></span>' ); ?>
    		</div>
    		<div style="clear: both;"></div>
    		<?php
    		/* example code for using the wp_pagenavi plugin */
    		if ( function_exists( 'wp_pagenavi' ) ) {
    			echo "<br />";
    			wp_pagenavi( array( 'query' => $query ) );
    		}
    		?>
    	</div>
    	<div style="clear: both;"></div>
    
    	<
    	? php
    } else {
    	echo "Não foram encontrados resultados";
    }
    ?>
    
    #108801

    Ross
    Keymaster

    Hi Tom

    Archive display method uses the global $wp_query object, rather than the local $query.

    So it should be:

    Found <?php 
    global $wp_query;
    echo $wp_query->found_posts; 
    ?> Results<br />

    Thanks

    #108556

    Trevor
    Participant

    Can you use the post_count variable instead of found_posts?

    #105908

    Anonymous
    Inactive

    Hello, firs of all: great plugin! Thank you.
    Problems:
    1. need to show number of total results. Is it working; <?php echo $sf_query->found_posts; ?> ?
    2. Is it possible display terms of search?
    Thank you

    #105232

    Trevor
    Participant

    Hi. You have ‘Use Background Processes’ disabled in the plugin settings. This will mean that the results may be wrong unless you keep up to date with rebuilding the cache.

    So, to the code. This code is wrong:

    $total_results = $query->found_posts;

    It must be:

    $total_results = $wp_query->found_posts;

    I have edited it for you.

    #105029

    Anonymous
    Inactive

    Trevor I don’t understand your question.
    I actually got $total_results = $query->found_posts; and echo $total_results.

    If you ask for Search&Filter form options in “display results tab” I got this:

    Results URL: http://stude.masterbip.com/test/
    Load results using Ajax? YES
    Make searches bookmarkable? YES
    Only use Ajax on the results page? NO
    Scroll window to: none
    Ajax Container: #propresults
    Pagination Type: Normal
    Pagination selector: .paginacion ul li a
    Show loading icon? YES

    I can give you admin credentials if you want. Many thanks!

    I think all is working but that results counter…

    Thanks again in advance!

Viewing 10 results - 101 through 110 (of 174 total)