Forums › Forums › Search & Filter Pro › Trouble with get_fields_html
Tagged: Display filtered data
- This topic has 3 replies, 2 voices, and was last updated 8 years, 11 months ago by Ross.
-
Anonymous(Private) December 3, 2015 at 12:01 am #31297
I’m trying to output the filtered data using your instructions on the Accessing the Search Data page (http://www.designsandcode.com/documentation/search-filter-pro/accessing-search-data/). However, the outputted field names and respective data are not wrapped in any sort of html tag.
I would like the output to look something like this:
<div class=”filterdata”>
<div class=”fieldname”>Categories:</div>
<div class=”fielddata”>Community<br/>Arts</div>
</div>Is that possible by manipulating the sf_current_query?
Ross Moderator(Private) December 3, 2015 at 6:42 pm #31361Please don’t bump – I’m working my way through tickets and will get to this one too.
Thanks
Ross Moderator(Private) December 8, 2015 at 1:54 pm #31706Hi Stephen
The active query class is not currently too well documented (as its just been created its subject to change a little) but you can certainly change the output of this field.
Please take a look at this example:
$args = array( "str" => '<strong>%1$s</strong>: %2$s', "field_delim" => '<hr />' ); echo $sf_current_query->get_fields_html(array("_sft_category", "_sft_post_tag"), $args);
You can see
str
variable is the format output of html for each field, in the example above I’ve added<strong>
tags around the nameThe next is
field_delim
– this is what is used to join the strings for each field – default is<br />
but you can change this to anything.I think with these two arguments there should be no issues with formatting the way you want.
Thanks
-
AuthorPosts