-
AuthorSearch Results
-
November 17, 2016 at 4:37 pm #70903
In reply to: Settings & Default / Post (wrong default order)
AnonymousInactiveHi,
thanks for your help!!!
It wasn’t the wpml plugin,
but the custom code (that I was sure it wasn’t in cause)
I had to add the bold section here to make it workfunction sf_filter_query_args( $query_args, $sfid ) { if($sfid==1225){ global $searchandfilter; $sf_current_query = $searchandfilter->get(1225)->current_query(); $sf_current_query->get_field_string("_sfm_event_archives"); $_sfm_event_archives_array = $sf_current_query->get_array(); $archive_is_check = $_sfm_event_archives_array[_sfm_event_archives][active_terms][0][value]; //print_r($archive_is_check); if($archive_is_check != '1'){ $args_custom = array( <strong>"meta_key" => "imic_event_start_dt", "orderby" => "meta_value_num", "order" => "ASC",</strong> "meta_query" => Array ( "event_archives" => Array ( "key" => "event_archives", "value" => "0" ) ) ); $query_args = array_merge($query_args, $args_custom); } // si aucun filtre d'appliqué //if($sf_current_query->is_filtered()!=1){} } return $query_args; } add_filter( 'sf_edit_query_args', 'sf_filter_query_args', 100, 2 );Thanks again for your help guys!
Really nice plugin!November 16, 2016 at 5:49 pm #70670In reply to: Hide initial results on first page load (continued)
AnonymousInactiveThanks for that! Got it working by testing for
($sf_current_query->get_field_string("_th_private_page_category")=="Page Categories: All Page Categories")You can close this now, cheers.
November 15, 2016 at 11:39 pm #70441Topic: Get date range from current archive.php url
in forum Search & Filter Pro
AnonymousInactivehttps://domainnamehere.com/resources/?_sft_resourcetype=press-releases&post_date=01012016+12312016
I’ve had success getting the query variable for the taxonomy term “press-releases” using the code below, but cannot successfully retrieve the date range, either aggregated or individually as from date and to date. Can you enlighten me?
global $searchandfilter; $sf_current_query = $searchandfilter->get(5277)->current_query(); $type = $sf_current_query->get_field_string("_sft_resourcetype"); //returns press-releases $daterange = $sf_current_query->get_field_string("post_date"); // returns nothing Have also tried: $daterange = $sf_current_query->get_field_string("_sfm_post_date"); // returns nothing, even with url reflecting _sfm_ prefixOctober 20, 2016 at 10:15 am #65274Topic: Order results by ACF type of field
in forum Search & Filter Pro
AnonymousInactiveHi,
How could I order results by ACF type of field “powierzchnia”?<?php while ($query->have_posts()) { $query->the_post(); ?> <a href="<?php the_permalink(); ?>"> <ul> <li><?php the_title(); ?></li> <?php if (get_field ('powierzchnia') ) : ?> <li><span><?php echo the_field ('powierzchnia'); ?></span> m<sup>2</sup></li> <?php endif; ?>Regards
October 5, 2016 at 12:22 pm #62153In reply to: Doesn't referesh
AnonymousInactiveHi Trevor,
My code:
<div id="results"> <?php query_posts($query_string . "&meta_key=premium&orderby=meta_value"); ?> <?php while (have_posts() ) : the_post(); ?> <div class="<?php if (get_field('premium')) { echo 'premium'; } ?> row-fluid padM marginDownS bRadiusM brightenCat resumenFicha"> <a href="<?php the_permalink(); ?>" rel="bookmark" title="<?php the_title_attribute(); ?>"> <div class="col-md-4 col-sm-6 col-xs-2 erasePad"> <?php the_post_thumbnail( 'medium', array('class' => 'img-responsive bRadiusM')); ?> </div> <div class="col-md-8 col-sm-6 col-xs-10"> <h4 class="text-left secondColor textSizeM"> <?php if (in_category (array ('playas', 'municipios'))): ?> <?php the_title(); ?> <?php else: ?> <?php the_title(); ?> <?php endif ?> </h4> <p class="textSizeS mainColor esconder_xs"> <?php the_field('ciudad'); ?> <?php the_field('cul_ciudad'); ?> <?php the_field('en_municipio'); ?> <?php the_field('rut_salida'); ?> <?php the_field('pn_municipios'); ?> </p> <div class="esconder_xs"> <?php the_excerpt(array('class' => 'greyFont')); ?> </div> </div> </a> </div> <?php endwhile;?> <div id="pagination"> <?php wp_pagenavi( ); ?> </div> </div>#results is set to “result container”.
And there are no javascripts errors… only two 404 getting a old image.
Thanks
rgds
September 8, 2016 at 7:47 pm #57011In reply to: Preselecting taxonomy?
AnonymousInactiveOk, so I managed selecting the checkbox with some jQuery added via functions.php:
//Select sector in posts filter add_action('wp_footer', 'sectorpostsfilter'); function sectorpostsfilter(){ if (function_exists('get_field')) : $sectorobject = get_field('taxonomy_sector'); $sectorid = $sectorobject->term_id; if ($sectorid) : ?> <script type='text/javascript'> jQuery = jQuery.noConflict(); jQuery(function( $ ) { $('.sf-item-<?php echo $sectorid; ?> input').prop('checked', true); }); </script><?php endif; endif; }And by altering the query within the template:
<?php if (function_exists('get_field')) : $sectorobject = get_field('taxonomy_sector'); $sectorslug = $sectorobject->slug; endif; $loop = new WP_Query( array( 'sectors' => $sectorslug ) ); while ( $loop->have_posts() ) : $loop->the_post(); get_template_part( 'loop', 'post' ); endwhile; wp_reset_postdata(); ?>September 2, 2016 at 2:57 pm #56465In reply to: Extra space in search results
AnonymousInactiveThanks, I fixed that. Your plugin still adds extra paragraph tags and br tags.
<?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 style="width:100%;"> <?php while ($query->have_posts()) { $query->the_post(); ?> <div class="result"> <div class="photo"> <?php if (get_field('property_main_image') != '') { ?> <img src="<?php the_field('property_main_image'); ?>" alt="<?php get_field('address'); ?>" /> <?php } else { ?> <img src="/CreativeHomes/wp-content/uploads/2016/08/image-placeholder-500x500.jpg" alt="image coming soon" /> <?php } ?> </div> <div class="status"><?php echo get_field('status'); ?></div> <div class="details"> <?php echo '<h4>$' . get_field('price') . ' </h4>'; echo '<p>' . get_field('address') . '<br>'; echo get_field('city') . ', '; echo get_field('state'); echo get_field('zip') . '</p>'; echo '<p class="spex">' . get_field('bedrooms') . ' BEDROOMS • '; echo get_field('bathrooms') . ' BATHROOMS<br>'; echo '<span class="secondline">' . get_field('square_footage') . ' SQ FT • '; echo get_field('garages') . ' CAR GARAGE</span>'; echo '<span>MLS# ' . get_field('MLS') . '</span></p>';?> <div class="linx"> <a href="#"><img src="/CreativeHomes/wp-content/uploads/2016/08/CH_Button_Photos_Grey.png" alt="see photo gallery" /></a> <a target="_blank" href="<?php echo get_field('map_it_link'); ?>"><img src="/CreativeHomes/wp-content/uploads/2016/08/CH_Button_MapPin_Grey.png" alt="google map for location" /></a> <a target="_blank" href="<?php echo get_field('download_floorplan'); ?>"><img src="/CreativeHomes/wp-content/uploads/2016/08/CH_Button_Collateral_Grey.png" alt="brochure download" /></a> </div><!--end linx--> <a href="<?php echo get_permalink(); ?>"><img src="/CreativeHomes/wp-content/uploads/2016/08/details-button.png" width="122" alt="details" /></a> </div><!--end details--> <div class="interact"> <span><?php the_favorites_button($post_id, $site_id); ?></span> <span><img src="/CreativeHomes/wp-content/uploads/2016/08/check-icon.jpg" />Compare</span> <span><?php if ( function_exists( 'ADDTOANY_SHARE_SAVE_KIT' ) ) { ADDTOANY_SHARE_SAVE_KIT(); } ?>Share</span> <div class="clearfix"> </div> </div><!--end interact--> </div><!--end result--> <?php } ?> </div> <?php } else { echo "No Results Found"; } ?>September 2, 2016 at 2:54 pm #56464In reply to: Extra space in search results
TrevorParticipantI can see a coding error on line 46:
<?php if (get_field('property_main_image') != '') { ?>This
ifis started, but not ended. It needs to end before line 93.September 2, 2016 at 1:50 pm #56455In reply to: Extra space in search results
AnonymousInactive<?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 style="width:100%;"> <?php while ($query->have_posts()) { $query->the_post(); ?> <div class="result"> <?php if (get_field('property_main_image') != '') { ?> <img />" alt="" width="400px" /> <div class="status"><?php echo get_field('status'); ?></div> <div class="details"> <?php echo '<h4>$' . get_field('price') . ' </h4>'; echo '<p>' . get_field('address') . '<br>'; echo get_field('city') . ', '; echo get_field('state'); echo get_field('zip') . '</p>'; echo '<p class="spex">' . get_field('bedrooms') . ' BEDROOMS | '; echo get_field('bathrooms') . ' BATHROOMS<br>'; echo '<span class="secondline">' . get_field('square_footage') . ' SQ FT | '; echo get_field('garages') . ' CAR GARAGE</span>'; echo '<span>MLS# ' . get_field('MLS') . '</span></p>';?> <div class="linx"> <a href="#"><img src="/CreativeHomes/wp-content/uploads/2016/08/CH_Button_Photos_Grey.png" alt="see photo gallery" /></a> <a target="_blank">"><img src="/CreativeHomes/wp-content/uploads/2016/08/CH_Button_MapPin_Grey.png" alt="google map for location" /></a> <a target="_blank">"><img src="/CreativeHomes/wp-content/uploads/2016/08/CH_Button_Collateral_Grey.png" alt="brochure download" /></a> </div><!--end linx--> <a>"><img src="/CreativeHomes/wp-content/uploads/2016/08/details-button.png" width="122" alt="details" /></a> </div><!--end details--> <div class="interact"> <span><?php the_favorites_button($post_id, $site_id); ?></span> <span><img src="/CreativeHomes/wp-content/uploads/2016/08/check-icon.jpg" />Compare</span> <span><?php if ( function_exists( 'ADDTOANY_SHARE_SAVE_KIT' ) ) { ADDTOANY_SHARE_SAVE_KIT(); } ?>Share</span> </div><!--end interact--> </div><!--end result--> <?php } ?> </div> <?php } else { echo "No Results Found"; } ?>August 30, 2016 at 10:17 am #56017In reply to: Echo value from checked box
TrevorParticipantIn PHP you need to take the string and modify it. The first thing is to remove the
Location:string. So, you use the PHP Search function to find the:, like this:$return_string = $sf_current_query->get_fields_html(array("_sft_locatie"); $colon_pos = strpos($return_string, ":");Then you fetch the right most part of the return_string after the colon:
$return_string_trim = substr($return_string, $colon_pos+1);Then you replace the commas with
<br />:$return_string_html = str_replace(",", "<br />", $return_string_trim);And then you return the string:
return $return_string_html;At least, I think ….
-
AuthorSearch Results
Search Results for 'get_field'
-
Search Results
-
https://domainnamehere.com/resources/?_sft_resourcetype=press-releases&post_date=01012016+12312016
I’ve had success getting the query variable for the taxonomy term “press-releases” using the code below, but cannot successfully retrieve the date range, either aggregated or individually as from date and to date. Can you enlighten me?
global $searchandfilter; $sf_current_query = $searchandfilter->get(5277)->current_query(); $type = $sf_current_query->get_field_string("_sft_resourcetype"); //returns press-releases $daterange = $sf_current_query->get_field_string("post_date"); // returns nothing Have also tried: $daterange = $sf_current_query->get_field_string("_sfm_post_date"); // returns nothing, even with url reflecting _sfm_ prefixHi,
How could I order results by ACF type of field “powierzchnia”?<?php while ($query->have_posts()) { $query->the_post(); ?> <a href="<?php the_permalink(); ?>"> <ul> <li><?php the_title(); ?></li> <?php if (get_field ('powierzchnia') ) : ?> <li><span><?php echo the_field ('powierzchnia'); ?></span> m<sup>2</sup></li> <?php endif; ?>Regards