Support Forums

The forums are closed and will be removed when we launch our new site.

Looking for support? You can access the support system via your account.

Forums Forums Search Search Results for 'Sample Results Template'

Viewing 9 results - 151 through 159 (of 159 total)
  • Author
    Search Results
  • #22169

    In reply to: Search on custom field


    Jesús de la Plaza
    Participant

    @Ross > I’m currently using Relevanssi, and all seems to be working fine. Not sure what’s the bug you pointed out on current version of your plugin, but i’m getting the expected results, searchs quick (by the moment i’ve not inserted all data, just samples) and looks stable. I read about many issues with large DB using Relevanssi and its caching table data method, but looks like it’s disabled on its latest version, no sure. That’s why i was trying to avoid it. Let’s see how it goes with many data uploaded.


    @iaeon
    > It doesn’t matter if you created your custom posts with Pods or any other method, S&F will work the same, you will just need to create the form, set your custom post and use shortcode or templates to display results. As i’m already with my hands dirty with this 🙂 maybe i can give you a hand if you get stuck. Let me know.

    #22166

    In reply to: Single Page Pagination


    Ross
    Keymaster

    Hi Tyrone

    It seems like something in a plugin or theme is interfering with the pagination.

    WP has several hook which can be used to modify the html of the actual pagination, which I think is happenign on your setup.

    Probably there is a check and if is_single() is true then something is removing the pagination.

    When an ajax request is performed is_single will be false which might be why you are seeing this.

    I would try changing your theme, and disabling your plugins to find the cause.

    Alternatively, you could try to create your pagination in another way, something where this other plugin or theme won’t modify the pagination – perhaps you can try this – https://wordpress.org/plugins/wp-pagenavi/ – The S&F results template has some sample code for this plugin.

    Thanks

    #16973

    Ross
    Keymaster

    Hey Sabrina

    The template: Plugins > search-filter-pro > templates > results.php, is only to be used when displaying results using a shortcode.

    If you are using “as archive” there is no sample template, because it should be a template from your theme.

    Take a look in your theme folder for templates you could use… under “display results” and under “filename” try any of the following: archive.php, search.php or index.php, most themes have these templates as standard.

    Thanks

    #15468

    Hi!

    I´m using a search with 2 taxonomies which works nice on the main language (IT). But the same form does not work with on the english version of the page.
    In the drop-down it shows the correct count for each taxonomy term, but I always get “no results found” back.

    The posts are 1700 custom-post types and they are all duplicated to english, because all custom fields are separated for each language. e.g. date_en, date_it and the template is just echoing just the fields that correspond to the current language.

    This is my results.php

    Thanks for any advise.

    Philipp

    <?php
    /**
     * Search & Filter Pro
     *
     * Sample Results Template
     *
     * @package   Search_Filter
     * @author    Ross Morsali
     * @link      http://www.designsandcode.com/
     * @copyright 2014 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(ICL_LANGUAGE_CODE=='it'){$found="Trovato ";$res=" risultati";$nextTXT="Pagina Seguente";$prevTXT="Pagina Precedente";$lang=1;}
    else{$found="Found ";$res=" results";$nextTXT="Next Page";$prevTXT="Previous Page";$lang=2;}
    
    if ( $query->have_posts() )
    {
    ?>
    <div id="counter">
    	 <?php echo $query->found_posts.$res; ?><br />
    
    </div>
    
    		<ul id="catalogo-results">
    
    	<?php
    	while ($query->have_posts())
    	{
    		$query->the_post();
    
    		$tit=get_post_meta(get_the_ID(), "wpcf-titolo", true);
    		$limit=50;
    		// if(strlen($tit) > $limit) {
    
    		//$regex = "/(.{1,$limit})\b/";
    		//preg_match($regex, $tit, $matches);
    		// $tit= $matches[1]."...";
    		if ($lang==1){
    
    			if (trim(get_post_meta(get_the_ID(), "wpcf-titolo_pub", true))=='') {
    				$titolo=get_post_meta(get_the_ID(), "wpcf-titolo", true);
    			}
    			else{
    				$titolo=get_post_meta(get_the_ID(), "wpcf-titolo_pub", true);
    			}
    
    			if ( (trim(get_post_meta(get_the_ID(), "wpcf-titolo_pub", true))=='')&&(trim(get_post_meta(get_the_ID(), "wpcf-titolo", true)))=='')
    			{
    				$notitle=true;
    				if (trim(get_post_meta(get_the_ID(), "wpcf-tipologia_pub", true))=='' ){ $titolo=get_post_meta(get_the_ID(), "wpcf-tipologia", true);}
    				else {$titolo=get_post_meta(get_the_ID(), "wpcf-tipologia_pub", true);}
    
    			}
    
    			//Autore IT
    
    			if (trim(get_post_meta(get_the_ID(), "wpcf-autore_pub", true))=='') {
    
    				$autore=get_post_meta(get_the_ID(), "wpcf-autore", true);
    			}
    			else{
    				$autore=get_post_meta(get_the_ID(), "wpcf-autore_pub", true);
    
    			}
    
    		}
    		else {
    			//EN
    			if (trim(get_post_meta(get_the_ID(), "wpcf-titolo_pub_en", true))=='') {
    				if (get_post_meta(get_the_ID(), "wpcf-titolo_pub", true)==''){
    
    					$titolo=get_post_meta(get_the_ID(), "wpcf-titolo", true);
    				}
    				else{
    					$titolo=get_post_meta(get_the_ID(), "wpcf-titolo_pub", true);
    
    				}
    			}
    			else{
    				$titolo=get_post_meta(get_the_ID(), "wpcf-titolo_pub_en", true);
    			}
    
    			//Autore
    
    			if (trim(get_post_meta(get_the_ID(), "wpcf-autore_pub_en", true))=='') {
    				if (get_post_meta(get_the_ID(), "wpcf-autore_pub", true)==''){
    
    					$autore=get_post_meta(get_the_ID(), "wpcf-autore", true);
    				}
    				else{
    					$autore=get_post_meta(get_the_ID(), "wpcf-autore_pub", true);
    
    				}
    			}
    			else{
    				$autore=get_post_meta(get_the_ID(), "wpcf-autore_pub_en", true);
    			}
    
    		}
    
    		$tit=$titolo;
    		$tit = (strlen($tit) > $limit) ? substr($tit,0,$limit).'...' : $tit;
    
    		//}
    ?>
    
    		<li class="box"><a href="<?php the_permalink();?>">
              		<div class="search-img">
    
                          <img src="/assets/js/loader.gif" data-original="http://www.lacarrara.it/catalogo-content/img/195x150/<?php echo get_post_meta(get_the_ID(), "wpcf-immagine", true);?>" class="search-img lazy" />
              </div>
              <div class="search-text">
    		<div class="search-autore">
    <?php echo $autore?>          </div>
    		<div class="search-titolo">
    <?php echo $tit;?>
              </div>
              		<div class="search-datazione">
    
    <?php
    
    		if (get_post_meta(get_the_ID(), "wpcf-datada_pub", true)!=''){
    			$datada=intval(get_post_meta(get_the_ID(), "wpcf-datada_pub", true));
    		}
    		else
    		{
    			$datada=intval(get_post_meta(get_the_ID(), "wpcf-da", true));
    
    		}
    
    		if (get_post_meta(get_the_ID(), "wpcf-dataa_pub", true)!=''){
    			$dataa=intval(get_post_meta(get_the_ID(), "wpcf-dataa_pub", true));
    		}
    		else
    		{
    			$dataa=intval(get_post_meta(get_the_ID(), "wpcf-a", true));
    
    		}
    
    		if (($dataa)==($datada))
    		{
    			$datazione2=$datada;
    		}
    		else{
    			$datazione2=$datada.'-'.$dataa;
    		}
    
    		if (trim(get_post_meta(get_the_ID(), "wpcf-dataacirca_pub", true))=='true') {
    			$datacirca =" circa";
    		}
    		else{
    			$datacirca ="";
    		}
    
    		if ($lang==2) {
    			if (trim(get_post_meta(get_the_ID(), "datadacirca_pub", true))=='true') {
    				$datacirca =" approx.";
    			}
    
    		}
    
    		echo $datazione2.$datacirca;
    ?>
    
           </div>
              </div>
              </a>
    		</li>
    
    		<?php
    	}
    
    ?>
    		      <div class="clear"></div>
    <div class="pagination">
    			<!--Page <?php echo $query->query['paged']; ?> of <?php echo $query->max_num_pages; ?><br /> -->
    
    <div class="buttons">
    		<div class="nav-next button"><?php previous_posts_link( $prevTXT ); ?></div>
    				<div class="nav-previous button"><?php next_posts_link( $nextTXT, $query->max_num_pages ); ?></div>
    
    </div>
    
    		<?php
    	/* example code for using the wp_pagenavi plugin */
    	if (function_exists('wp_pagenavi'))
    	{
    		echo "<br />";
    		wp_pagenavi( array( 'query' => $query ) );
    	}
    ?>
    	</div>
    
    	      </ul>
    
    		<?php
    }
    else
    {
    	echo "No Results Found";
    }
    ?>
    
    #13690

    In reply to: Pagination


    Ross
    Keymaster

    Ah I see

    You will find that with the shortcode method, it is creating a custom loop – which doesn’t work out of the box with most pagination, normally there are one or two additional steps to make pagination work with custom queries, but this depends on how you are implementing this.

    The sample results.php template has the code in it for the wp_page_navi plugin so if its enabled it should just display.

    Thanks

    #12508

    Ross
    Keymaster

    Hi Michael

    I’ve now spent a considerable amount of time on this and actually getting nowhere – in all my test setups, different themes/plugin configurations I cannot replicate your issue.

    I would likely say that the problem lies in this listing plugin you have…. However saying that, I had a look at the sample query generated that you pasted in an earlier post – and I cannot fathom how that could possibly produce duplicate posts – there is an inner join on the table – with it being an inner join (and the only join in this query), this means you do not get duplicates.

    I have a few notes/suggestions as I’ve noticed some other things which may or may not cause you problems…

    1) you are using a customised version of the template – in there I see a couple of queries which may interfere with the main loop (I doubt it but looking at everything here) – I would suggest removing or renaming the templates within your themes and letting S&F use its default one just to make sure.

    2) Searching meta data can be inherently problematic.

    From what I can tell, your _content_field_6 is multiple choice (in the admin) – so users can select multiple options for this field

    Option 1 Value 1 => 1
    Option 1 Value 2 => 2
    Option 1 Value 3 => 3
    Option 1 Value 4 => 4
    Option 1 Value 5 => 5

    The problem here is, these options, internally, (say a you chose the first three options) are stored as 1, 2, 3 etc…

    Now, to have a single meta field, contain multiple values you must serialise the data

    So if the first 3 options were ticked you would imagine it is stored something like:
    _content_field_6 => 1,2,3

    However when WP, or SQL in general is storing serialised data it is being stored like:

    _content_field_6 => "a:3:{i:0;i:1;i:1;i:2;i:2;i:3;}"

    Now, searching serialised data is nearly impossible – so all we can do is a wildcard search…

    Now lets get on to the search form – if a user selects option “1” or “2” in the search form, then a LIKE comparison is performed, however a LIKE comparison against _content_field_6 for the number 1, will match almost any post that has serialised data in this field… So your results will be wildly inaccurate…

    …I’m hoping the above makes sense so far…!

    So.. if you want to get this to work, then saved values must be unique – instead of just numbers, so something like (purely as an example) would work…

    Option 1 Value 1 => one
    Option 1 Value 2 => two
    Option 1 Value 3 => three
    Option 1 Value 4 => four
    Option 1 Value 5 => five

    So if you as an admin, selected the first three options again against an ad, the serialised data would look like:

    _content_field_6 => 'a:3:{i:0;s:3:"one";i:1;s:3:"two";i:2;s:5:"three";}'

    And again if we take the example above, if someone was using the search form to look for the “option 1 value 1”, then a like comparison would be make against this field, but for a string “one” – which would then return this example ad and perform reasonably accurately!

    So to summarise, serialised data is bad for searching (but it sometime data must be saved this way), however if your serialised data is an array of numbers, representation options like “Option 1 Value 2”, then its going to be nearly impossible to search this accurately. This is just the nature of searching serialised data (its basically impossible to do accurately and crude at best).

    Hope that makes sense!!

    #10985
    [Resolved]

    Topic: Results page not found…


    Escape2ski
    Participant

    Hi again – sorry my last “problem” was just due to incomplete reading of the instructions! However, I have a genuine issue now…

    I want my results to show on a separate page. So I uncheck “Auto submit form” and “Load results using Ajax” (as well as adding a Submit button). I enter the URL of my page containing the results shortcode in “Template options”. But when I try a search, I get an “Error 404 – Page not found” error.

    A sample of the kind of URL it’s trying to resolve shows why it’s not going anywhere:

    http://[mysite.com]/search-results/advanced-resort-search/?_sfm_skiing_snowboarding=Skiing%20Only

    It’s tacking on the name of the search page (“advanced-resort-search”) to the results page (“search-results”).

    Why would it be doing that?

    If I remove the “/advanced-resort-search” from the URL, it shows my results as expected.

    Thanks for any suggestions you can offer!
    Adam

    #10022

    Ross
    Keymaster
    This reply has been marked as private.
    #7471

    Peer Fischer
    Participant
    <?php
    /**
     * Search & Filter Pro 
     *
     * Sample Results Template
     * 
     * @package   Search_Filter
     * @author    Ross Morsali
     * @link      http://www.designsandcode.com/
     * @copyright 2014 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
     * 
     * 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() )
    {
    $query->the_post();
    $myid = get_the_ID();
    	?>
    	
    	<div class="row">
    	<div class="col-xs-12 col-sm-12 col-md-12 col-lg-12">
    	<div class="filter-results" >
    	<?php echo $query->found_posts; ?> Ergebnisse  Seite <?php echo $query->query['paged']; ?> von <?php echo $query->max_num_pages; ?>
    	
    	<div style="float:right;">
    	<?php sf_pagination_prev_next($query->query['paged'], $query->max_num_pages); ?>
    	<?php sf_pagination_numbers($query->query['paged'], $query->max_num_pages, " "); ?>
    
    	</div>
    	</div>
    	</div>
        </div>
        <div class="row">
    
        <?php
        
       
       if ($myid == '3100') {
        echo '<div class="col-xs-12 col-sm-12 col-md-3 col-lg-3">';
       
       dynamic_sidebar( 'wein' );
        echo '</div>';
      }
     
    
    	while ($query->have_posts())
    	{
    		$query->the_post();
    		$post_type = get_post_type( get_the_ID() );
    	
    		?>
    
    	
    		
    		
    			
    			
    			
    				<?php 
    
    				switch ($post_type) {
    				    
    				    case 'wein': 
                            
                            echo '<div class="col-xs-12 col-sm-12 col-md-3 col-lg-3">';
    						echo '<div class="item-'.$post_type.'">'; 
    				    	$wine_id = get_the_ID();
    				    	$term_list = wp_get_post_terms($wine_id, 'winzer', array("fields" => "names"));
    						$title = get_the_title();
    				        $permalink = get_permalink();
    				        $name =  get_field('wine-name');
    				        $img_url =  get_field('wine-detail-image');
    
    				        if (empty($img_url)) {
    				        $img_url = 'http://www.weinamlimit.com/wordpress/wp-content/uploads/wine_empty.png';
    				       }
    				        $year =  get_field('wine-detail-year');
    				        $sf =  get_field('wine-detail-soul-faktor');
    				        $size =  get_field('wine-detail-size');
    				        echo '<div class="item-overlay"><div class="overlay-content">'.$sf.'<br>Flasche'.$size.'</div></div>';
    				        echo '<a href="'.$permalink.'" title="'.$title.'">';
    				        //echo '<img src="'.aq_resize( $img_url, '300').'" alt="'.$title.'"></a></div>';
    				        echo '<img src="'.aq_resize( $img_url, '300').'" ></a></div>';
    				        echo '<div class="wine-description"><h2><a href="'.$permalink.'" title="'.$title.'">'.$year.' '.$name.'</a></h2>';
    				        echo '<h3>'.$term_list[0].'</h3></div>';
    				        break;
    				    case 'winzer':
    				    	$grower_id = get_the_ID();
    				    	$term_list_country = wp_get_post_terms($grower_id, 'land', array("fields" => "names"));
    				    	$term_list_region = wp_get_post_terms($grower_id, 'anbaugebiet', array("fields" => "names"));
    				        $img_url =  get_field('winegrower-preview-image');
    				        $logo_url =  get_field('winegrower-logo');
    				        $title = get_the_title();
    				        $permalink = get_permalink();
    				        echo '<div class="col-xs-12 col-sm-12 col-md-6 col-lg-6">';
    						echo '<div class="item-'.$post_type.'">'; 
    						if (!empty($logo_url)){
    						echo '<div class="logo-overlay"><img src="'.$logo_url.'"></div>';}
    						echo '<a href="'.$permalink.'" title="'.$title.'">';
    				        //echo '<img src="'.aq_resize( $img_url, '600', '290' , true).'" alt="'.$title.'"></a></div>';
    				        echo '<img src="'.aq_resize( $img_url, '600', '290' , true).'" ></a></div>';
    				        echo '<div class="grower-description"><h2><a href="'.$permalink.'" title="'.$title.'">'.$year.' '.$title.'</a></h2>';
    				        echo '<h3>'.$term_list_region[0].', '.$term_list_country[0].'</h3></div>';
    				       
    				        break;
    				    
    				}
    
    		
    
    				
    
    				 ?>
    				
    			
    	
    			</div>
    
    		
    		<?php
    	}
    	?>
    
    </div>
    	<div class="row">
    	<div class="col-xs-12 col-sm-12 col-md-12 col-lg-12">
    	<div class="filter-results" >
    	<?php echo $query->found_posts; ?> Ergebnisse  Seite <?php echo $query->query['paged']; ?> von <?php echo $query->max_num_pages; ?>
    	
    	<div style="float:right;">
    	<?php sf_pagination_prev_next($query->query['paged'], $query->max_num_pages); ?>
    	<?php sf_pagination_numbers($query->query['paged'], $query->max_num_pages, " "); ?>
    
    	</div>
    	</div>
    	</div>
        </div>
    	
    	<?php
    }
    else
    {
    	echo "No Results Found";
    }
    ?>
    

    This is my results item, should be right?

Viewing 9 results - 151 through 159 (of 159 total)