-
AuthorSearch Results
-
November 9, 2018 at 3:14 pm #193395
In reply to: Show relationship ACF field in results
TrevorParticipantIt took me a little while, but this seems to do it:
<p>Secteur : <?php $cial_secteur = get_field('cial_secteur'); $cial_secteur_rec = $cial_secteur[0]; echo $cial_secteur_rec -> post_title;?></p>
November 8, 2018 at 5:19 pm #193240In reply to: Show relationship ACF field in results
AnonymousInactiveAt this time my code is :
<div class="commercial"> <h2><a href="<?php the_permalink(); ?>"><?php the_title(); ?></a></h2> <p>Mail : <?php the_field('cial_email'); ?></p> <p>Téléphone : <?php the_field('cial_telephone'); ?></p> <?php if( get_field('cial_das') ):?> <p>Univers : <?php the_field('cial_das'); ?></p> <?php endif; ?> </div> You can see the result at the bottom of this page : http://festilight.com/festilight-deco For exemple if you select "Atlantique", all the informations are good and visible. When I add <code><p>Univers : <?php the_field('cial_secteur'); ?></p></code> (there is a mistake, it's not "Univers :" but "secteur" it's like "localization :" in english but it's not a problem for now) So
<p>Univers : <?php the_field(‘cial_secteur’); ?></p>
That break my page and don’t show my footer.
November 8, 2018 at 4:49 pm #193238In reply to: Show relationship ACF field in results
TrevorParticipantAt the moment, this line:
<p>Univers : <?php the_field('cial_secteur'); ?></p>
Produces text like:
Univers : Atlantique
Yes?
What does
<?php $cial_sector = get_field('cial_secteur'); echo $cial_sector('cial_das');?>
Give you?
November 8, 2018 at 1:15 pm #193158In reply to: Show relationship ACF field in results
TrevorParticipantYou are trying to fetch the field data from a related Post Object?
So, your results Post might be ID #1234
But the Post Object found is ID #5678
So, when you use get_field, it must be like this:
get_field('cial_das', 5678)
So you must first find the ID of the relationship object to enable a lookup to be performed.
October 31, 2018 at 6:14 pm #192425In reply to: Checkboxen uncheck after ajax refresh
AnonymousInactiveThanks for the links about this subject and great to hear about this option coming to the plugin in 2019.
In this guide: https://searchandfilter.com/documentation/accessing-search-data/
I have to use a code and replace it with the form-id. But I have 9 different forms, using the same page-template, who are switched on and off by some widget logic.
Is their a possibility to use this code and let the code search for the right for id who is active on the page the user is visiting?:<?php //Get a single fields values using labels //replace <code>1526</code> with the ID of your search form global $searchandfilter; $sf_current_query = $searchandfilter->get(1526)->current_query(); echo $sf_current_query->get_field_string("_sft_category"); ?>
August 20, 2018 at 12:31 pm #185960In reply to: ACF data not being fetched and displayed in results
TrevorParticipantAh. So, you are using the shortcode results method, and you want to display ACF data. The guide to customising the appearance of the results is here:
https://searchandfilter.com/documentation/search-results/using-a-shortcode/#customising-the-results
You will need to do that first and then use the ACF documentation to add your own HTML/PHP to output as you want. This search will give you some snippets already posted on our forum:
https://support.searchandfilter.com/forums/search/results.php+acf+get_field/
For example, this post (and thread):
May 9, 2018 at 5:03 pm #176709In reply to: How do display the category in results?
AnonymousInactiveThat didn’t work but the one from the link you provided earlier did work.
Here’s the code:
global $searchandfilter; $sf_current_query = $searchandfilter->get(71131)->current_query(); $args = array( "str" => '%2$s', "delim" => array(", ", " - "), "field_delim" => ', ', "show_all_if_empty" => false ); $result_title = $sf_current_query->get_fields_html( array("_sft_ld_course_category"), $args );
Thank you for your help with this.
May 9, 2018 at 6:08 am #176590In reply to: How do display the category in results?
TrevorParticipantInstead do this I think:
<?php $args = array( "str" => '%2$s', "show_all_if_empty" => false ); echo $sf_current_query->get_field_html(array("_sft_ld_course_category"),$args); ?>
May 9, 2018 at 2:19 am #176578In reply to: How do display the category in results?
AnonymousInactiveFollow up:
The string that is returned for this:
<?php echo $sf_current_query->get_field_string("_sft_ld_course_category"); ?>
(ld_course_category is the course category for the learndash lms plugin)
is:
Course Categories: All Course Categories
Is there a way the to get rid of the “Course Categories:” portion of the string so I’m just left with the actual result?
May 7, 2018 at 11:55 am #176116In reply to: How to get all name terms of current filtered
TrevorParticipantIf you look at this post:
https://support.searchandfilter.com/forums/topic/display-multiple-terms/#post-171986
(and the thread it is in), and this thread (similar to your I think):
https://support.searchandfilter.com/forums/topic/issue-with-get_fields_html/
You will see how they resolved it. The documentation for this is here:
https://www.designsandcode.com/documentation/search-filter-pro/accessing-search-data/
-
AuthorSearch Results