Forums Forums Search Search Results for 'get_field'

Viewing 10 results - 161 through 170 (of 188 total)
  • Author
    Search Results
  • #43565

    Anonymous
    Inactive

    Hi,

    I’ve added the code but it seems to be throwing an error on the array. Am I missing something?
    <?php
    //Get a multiple fields values by passing an array of field names
    //replace 1526 with the ID of your search form
    global $searchandfilter;
    $sf_current_query = $searchandfilter->get(339)->current_query();
    echo $sf_current_query->get_fields_html(array(), array(‘show_all_if_empty’ => false)
    );
    ?>

    I’ve also added the code from the supplied link but it throws back the following error:
    array(2) { [“_sft_length”]=> array(5) { [“name”]=> string(13) “Yacht Lengths” [“singular_name”]=> string(12) “Yacht Length” [“all_items_label”]=> string(17) “All Yacht Lengths” [“type”]=> string(8) “taxonomy” [“active_terms”]=> array(1) { [0]=> array(4) { [“id”]=> int(6) [“name”]=> string(6) “40-50m” [“value”]=> string(6) “40-50m” [“count”]=> int(5) } } } [“_sft_toy”]=> array(5) { [“name”]=> string(15) “Yacht Hero Toys” [“singular_name”]=> string(14) “Yacht Hero Toy” [“all_items_label”]=> string(19) “All Yacht Hero Toys” [“type”]=> string(8) “taxonomy” [“active_terms”]=> array(1) { [0]=> array(4) { [“id”]=> int(16) [“name”]=> string(7) “Freezer” [“value”]=> string(7) “freezer” [“count”]=> int(5) } } } }

    Found on the same web link as before.

    #43562

    Trevor
    Participant

    Hi

    Ross tells me that there is additional functionality on this filter, he says this will be useful to you:

    get_fields_html(array(), array('show_all_if_empty' => false))
    

    Instead of what you used. As to the other x link feature, he says it is not there now, but is coming (as is an easier way to what you have above), but this may be useful to you:

    http://www.designsandcode.com/documentation/search-filter-pro/accessing-search-data/#Getan_array_offilterswithvalues_and_labels


    Anonymous
    Inactive

    Hi.
    I’m purchase search & filter pro, and this is absolutely amazing.
    But i need any things.
    1-) Is possible print custom field of custom post type in results? I try this code, but dont work in results.php from template folder:

    <?php
    	while ($query->have_posts())
    	{
    		$query->the_post();
    		
    		?>
    		<div>
    			<h4><a href="<?php the_permalink(); ?>"><?php the_title(); ?></a></h4>
    			<p><?php the_excerpt(); ?>
    			<?php
                              $post_object = get_field('pastilha_dianteira');
                              if( $post_object ): 
    
    	                  // override $post
    	                  $post = $post_object;
    	                  setup_postdata( $post ); 
    
    	                ?>
                            <?php the_field('numeracao_pastilha'); ?>
                      </div>
                      <?php wp_reset_postdata(); // IMPORTANT - reset the $post object so the rest of the page works correctly ?>
                     <?php endif; ?>
    		</div>
    		
    		<hr />
    		<?php
    	}
    	?>

    Any suggestion?

    2-) I need in results the taxonomies from that result. Example:
    TITLE OF POST – Taxonomy 1, Taxonomy 2, Taxonomy 3
    Content
    What’s code for it?

    Sorry for english.

    Cheers.

    #39701

    Anonymous
    Inactive

    Hi!
    Sorry for my late reply but I had to complete another project..
    If I do a var_dump I get the following:
    array(2) { [“authors”]=> array(5) { [“name”]=> string(7) “Authors” [“singular_name”]=> string(6) “Author” [“all_items_label”]=> string(11) “All Authors” [“type”]=> string(9) “post_type” [“active_terms”]=> array(1) { [0]=> array(3) { [“id”]=> int(39) [“name”]=> string(7) “Agenzie” [“value”]=> string(7) “agenzie” } } } [“_sf_post_date”]=> array(1) { [“active_terms”]=> array(2) { [0]=> array(1) { [“value”]=> string(8) “01032016” } [1]=> array(1) { [“value”]=> string(8) “16032016” } } } }

    In my form I have Authors (in this example value for that is “Agenzie”) and Post Date range fields.
    I am not expert in PHP…can you help me to get the authors and post date range?
    As $sf_current_query->get_field_string(“authors”) does not work.

    Thanks

    #37243

    Anonymous
    Inactive

    Hi, How would I display the sort order in a way similar to displaying categories or tags? Here’s the code I’m using, but only _sft_category and _sft_school display on my page.

    $args = array(
    	"str" => '<strong>%1$s</strong>: %2$s',
    	"show_all_if_empty" => false
    	//"field_delim" => '<hr />'
    	
    );
    echo $sf_current_query->get_fields_html(array("_sft_category", "_sft_school", "sort_order"), $args);

    Here’s a link to the test page:
    http://staging.cudenvertoday.org/articles

    Thanks!

    #37037

    In reply to: Custom field empty


    Anonymous
    Inactive

    Hello Ross,

    I have one example more detail.

    global $wp_query;
    $cat_obj = $wp_query->get_queried_object();
    $catid=$cat_obj->term_id;
    if ( $query->have_posts() )
    {
    $postfounds=$query->found_posts;
    ?>
    <p> <?php echo sprintf(get_field(‘titulo_encontrados’,’product_cat_’.$catid),$postfounds); ?></p>

    Then get_field(‘titulo_encontrados’,’product_cat_’.$catid) is empty when ajax is enabled.

    Thanks for your time.

    #36817

    Anonymous
    Inactive

    Custom fields (ACF) is empty when ajax is enabled, my titles and all custom fields into loop content is empty.

    Example: get_field(‘title_name’,’product_cat_’.$idcat)

    I need help with this.

    Thanks.

    #34998

    Anonymous
    Inactive

    Website is actually offline.

    I just put in page template:
    <?php
    //Get a single fields values using labels
    //replace 1526 with the ID of your search form
    global $searchandfilter;
    $sf_current_query = $searchandfilter->get(147)->current_query();
    echo $sf_current_query->get_field_string(“_sfm_xxx”);

    ?>

    and Its echo nothing. I’m using ACF fileds

    #34979

    Anonymous
    Inactive

    Im trying something like and its not working

    <?php
    //Get a single fields values using labels
    //replace 1526 with the ID of your search form
    global $searchandfilter;
    $sf_current_query = $searchandfilter->get(147)->current_query();
    echo $sf_current_query->get_field_string(“_sfm_xxx”);

    ?>

    Url looks like this:
    http://www.xxx.com/?_sfm_xxx&#8230;


    Anonymous
    Inactive

    I’ve a results.php with

    <?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
     *
     */
    
    /* ROSS DEV CODE START */
    //var_dump($query->posts);
    
    /* $i = 1;
    foreach($query->posts as $tpost)
    {
    	echo $i." | ".$tpost->post_title;
    	echo "<br />";
    	$i++;
    }
    echo "<hr />";
    $i = 1;
    while ($query->have_posts())
    {
    	$query->the_post();
    	echo $i." | ";
    	the_title();
    	echo "<br />";
    	$i++;
    }
    /* ROSS DEV CODE END */
    		
    
    if ( $query->have_posts() )
    {
    
    	?>
    	
    	<div class="row">
    	<div class="col-xs-12 col-sm-12 col-md-12 col-lg-12">
    	<div class="filter-results" >
    	<div class="filter-results-page"><?php echo $query->found_posts; ?> Ergebnisse  Seite <?php echo $query->query['paged']; ?> von <?php echo $query->max_num_pages; ?></div>
    	
    	<div class="filter-results-pagination">
    	<?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
        
       
    
    	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-4 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();
    				        $stock = get_field('wine-stock');
    				        $stock_text = get_field('wine-stock-text');
    				     
    
    				        if (empty($stock_text)) {
    
    				        	$stock_text = "Ausverkauft!";
    				        }
    
    				       if (!empty($stock)) {
    				         echo '<div class="wine-teaser"> <span></span><p>'.$stock_text.'</p></div>';
    				       }
    
    				        $name =  get_field('wine-name');
    				        $img_url =  get_field('wine-detail-image');
    
    				        if (empty($img_url)) {
    				        $img_url = '/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').'" alt="'.$title.'"></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();
    				 
    				        $exclusive = get_field('winegrower-exclusive');
    				        if ($exclusive == 1) {
    				        	$addexclusive = ' - Exklusiv bei Wein am Limit';
    				        } else {
    				        	$addexclusive = '';
    				        }
    				        echo '<div class="col-xs-12 col-sm-12 col-md-6 col-lg-6">';
    						echo '<div class="item-'.$post_type.'">'; 
    						
    						if (!empty($img_url)) {
    								if (!empty($logo_url)){
    								echo '<div class="logo-overlay"><img src="'.aq_resize( $logo_url, '100').'"></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).'" alt="'.$title.'"></a>';
    				        }
    				        echo '</div>';
    
    				        echo '<div class="grower-description"><h2><a href="'.$permalink.'" title="'.$title.'">'.$title.$addexclusive.'</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" >
    	<div class="filter-results-page"><?php echo $query->found_posts; ?> Ergebnisse  Seite <?php echo $query->query['paged']; ?> von <?php echo $query->max_num_pages; ?></div>
    	
    	<div class="filter-results-pagination">
    	<?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 '<div class="filter-results" style="height:38px;"><div class="filter-results-page"><div class="filter-results-pagination"></div></div></div>';
    	echo '<div style="width:100%; text-align:center;min-height:400px;padding-top:100px;">Keine Produkte gefunden.</div>';
    }
    ?>

    which is workin no more after update to S&F 2.0.3 (from 1.4.2) – I’ve rebuild all caches, the site stay just empty. Any ideas on this?

    Best.

Viewing 10 results - 161 through 170 (of 188 total)