Search Results for 'get_field'

Forums › Forums › Search › Search Results for 'get_field'

Viewing 10 results – 191 through 200 (of 219 total)
  • Author
    Search Results
  • #43504

    Anonymous
    Inactive

    Hi,

    I have used the following code to show the specific taxonomy fields within the search form:

    <?php
    	global $searchandfilter;
    	$sf_current_query = $searchandfilter->get(339)->current_query();
    	echo $sf_current_query->get_fields_html(
    		array("_sft_length", "_sft_rate", "_sft_guest", "_sft_location", "_sft_toy")
    	);
    ?>

    However this code displays the full list of fields continuously.

    Is there a way to style and list only the content from each taxonomy used for a search, after form submission?

    Further to this, once the content is displaying independently is there a way to assign a small “cross” to be able to remove this specific field from the search?

    Page found at http://www.cascadetest.co.uk/oneocean.com/charter-overview/


    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.


    Anonymous
    Inactive

    Hi,
    I have a multiselect Advanced Custom Fields dropdown in my form, which is populated dynamically using a mix of AJAX and PHP. Basically it’s populated from the user’s selection in a dropdown above it.

    I’d like to filter search results by the values in this dynamically populated dropdown. However, within my posts, the dropdown selections are saved in the db as ids, instead of their labels. In order to display the names on my blog, I use ACF’s “get_field_object” method, then can retrieve the label by accessing the object’s [‘choices’] array. However, in the filter, it only shows ids, and I need the user to be able to see the label so that he/she knows what they’re filtering on.

    Since the dropdown is populated dynamically, the label is not automatically pulled in from the ACF field. Is there another way I can get the label to display if I only have the value stored in my database? Please let me know, as this might be a blocker. Thanks!!

    #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


    Anonymous
    Inactive

    Hi!
    I am using Avada theme.
    I found some posts and this helpful link to know how to display search terms on Title bar:
    https://www.designsandcode.com/documentation/search-filter-pro/accessing-search-data/

    I added the following code:
    global $searchandfilter;
    $sf_current_query = $searchandfilter->get(8444)->current_query();
    $sf_fields = $sf_current_query->get_fields_html(
    array( “_sft_category”, “authors”, “post_date”)
    );

    $title = sprintf( __( ‘Search results for: %s’, ‘Avada’ ), get_search_query() . ‘ ‘ . $sf_fields );

    It works for Category, but not for the other fields I have in the searcg form as Athors and post_date range.
    This is the page with the Advanced Search:
    http://www.amiciperlacitta.it/news/la-bussola/ricerca-avanzata/
    Can you help me?
    Waiting for your kind reply

    #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;

Viewing 10 results – 191 through 200 (of 219 total)
Search & Filter Support
Privacy Overview

This website uses cookies so that we can provide you with the best user experience possible. Cookie information is stored in your browser and performs functions such as recognising you when you return to our website and helping our team to understand which sections of the website you find most interesting and useful.

We also use cookies to store items in your cart as well as allowing your to login on the site.

You can adjust all of your cookie settings by navigating the tabs on the left hand side.

By continuing to use this site, you also agree to our Privacy Policy.