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 & Filter Pro Taxonomy not working with WPML 2nd language

Viewing 6 posts - 1 through 6 (of 6 total)
  • Philipp von Hellberg
    #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";
    }
    ?>
    
    Ross Moderator
    #15474
    Philipp von Hellberg
    #15483
    This reply has been marked as private.
    Philipp von Hellberg
    #15484
    This reply has been marked as private.
    Ross Moderator
    #15632
    This reply has been marked as private.
    amtln15
    #28492

    Hello!

    I think I’m having the same issue. Is it possible to post a solution?
    Thanks!

Viewing 6 posts - 1 through 6 (of 6 total)

The forum ‘Search & Filter Pro’ is closed to new topics and replies.