Trouble with get_fields_html

Forums › Forums › Search & Filter Pro › Trouble with get_fields_html

Viewing 4 posts – 1 through 4 (of 4 total)
  • Anonymous
    #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?

    Anonymous
    #31360

    Anyone?
    Anyone?

    Ross Moderator
    #31361

    Please don’t bump – I’m working my way through tickets and will get to this one too.

    Thanks

    Ross Moderator
    #31706

    Hi 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 name

    The 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

Viewing 4 posts – 1 through 4 (of 4 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.