Forums Forums Search & Filter Pro No results, no message appears

Tagged: 

Viewing 10 posts - 11 through 20 (of 20 total)
  • Anonymous
    #112313
    This reply has been marked as private.
    Trevor
    #112315

    At this time, we do not have such an option. The better option would be to Hide Empty values for now.

    Anonymous
    #114330

    I decided to use the shortcode method to get the message of when there were no results as well as having other plugin features. It seems to be working just as I intended, but I still can not seem to get everything I wanted on the results page.

    I’m using the Pods Framework to create custom post types and taxonomies, and there are search fields that I would like to return like price, location, a brief summary, and so on. I know that it is possible to customize search results by editing the results.php file, but I am not able to display those fields in the listing of each result. I tried to follow this example:

    http://webdesignforidiots.net/2013/04/pods-pages-and-templates-and-more-pages-oh-my/

    I can display these fields on other pages, through the Pods shortcode or Pods templates, I can not apply to Search & Filter Pro.

    I used this code in a version applying it to results.php, but nothing happens, just a long and infinite load.

    I ask for your help.

    Thank you

    Trevor
    #114394

    I would need to see the results.php file.

    If you paste it here, please make it a ‘code block’ by putting a back tick before and after the code (it is the key on the left of the ‘1’ key on most keyboards:

    Snippet Key

    Anonymous
    #114400

    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";
    }
    ?>
    
    Trevor
    #114427

    Which does not work? 2553.php?

    Which part does not work? Maybe the parts like this?

    <?php echo do_shortcode('[pods field="resumo_objectivos"]'); ?>
    
    Anonymous
    #114482
    This reply has been marked as private.
    Trevor
    #114508

    I would have thought you would simply use the Pods field() function, like this:

    <?php echo field('resumo_objectivos');?>
    

    But I am not familiar with the Pods plugin. This is so much easier in ACF, which would be this:

    <?php echo get_field('resumo_objectivos');?>
    

    In ACF, you can optionally specify to Post ID (using get_the_ID(), and the format), but if yu don’t, it assumes the ID of the current post in the loop. The code example that I can see assume you will run the loop from Pods, which is not helpful.

    Anonymous
    #114738
    This reply has been marked as private.
    Trevor
    #114751

    It is using $mypod. A theme normally uses $wp_query

    You really need to talk to someone at Pods. With ACF this is easy and is well documented, but I cannot find it for Pods. The query has already been run, so there is no need to run it again.

Viewing 10 posts - 11 through 20 (of 20 total)