Forums Forums Search & Filter Pro Trouble with get_fields_html

  • This topic has 3 replies, 2 voices, and was last updated 9 years ago by Ross.
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)