-
Search Results
-
Topic: How to style the search data
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/
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.
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!!
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 replyTopic: Display Sort Order?
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/articlesThanks!
Topic: Custom field empty
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.