Hi Nina
It should be like the example I showed you – I’ve reformatted it to make it more readable:
$fields = array(
"_sft_leadership",
"_sft_management",
"_sft_governance",
"_sft_crosscutting"
);
$args = array(
"field_delim" => "<br />",
"delim" => ", ",
"show_all_if_empty" => true
);
echo $sf_current_query->get_fields_html($fields, $args);
field_delim
is the delimiter between the data for each field,
delim
is the delimiter between the actual options selected within a field
Thanks
AnonymousInactive
Hello again Ross and thank you for your guidance!
I installed updated plugin. I saw the class code that utilizes replacing args.
I still have two questions:
Question 1. if this code is correct – meaning should $args be where it is now:
echo $sf_current_query->get_fields_html(
array( “_sft_leadership”, “_sft_management”, “_sft_governance”, “_sft_crosscutting” )
$args
);
OR it should go inside of the () like I’m guessing – please see below
echo $sf_current_query->get_fields_html(
array( “_sft_leadership”, “_sft_management”, “_sft_governance”, “_sft_crosscutting”, $args )
);
Question 2. After you confirm which version to use, I am not clear where to put this code.
When I try to add “my guess” version on the top of the archive page I see that args are not being replaced.
I on purpose changed the args to be explicitly different
$args = array(
“field_delim” => “X”,
“delim” => “,Y “,
“show_all_if_empty” => false
);
But when I use echo to output them, they come as: args are: , , – link to archive page is below
http://leadernetnina.wpengine.com/resources/?_sf_s=manager&_sft_leadership=leading-change%2Cmotivation
Sorry for being dense. As I said I’m a beginner.
Really need your help with this critical project.
Thank you again, Nina
Hi Nina
I noticed a PHP error in the active query class so I’ve just emailed you a fix.
Once you get that, you can pass an array of arguments to the function, which controls the delims between the fields, please see:
$args = array(
"field_delim" => "",
"delim" => ", ",
"show_all_if_empty" => true
);
echo $sf_current_query->get_fields_html(
array( "_sft_leadership", "_sft_management", "_sft_governance", "_sft_crosscutting" )
$args
);
Hope that helps!
– a word of warning, there is still some functionality to add to this class, and as this is the first version, I already think that the syntax for accessing the methods of this class might change – be sure to keep an eye on the changelogs in the next couple of updates.
Thanks
AnonymousInactive
Hello Ross,
when I select multiple checkboxes in my form the URL string has terms separated by comma(%2C)
http://leadernetnina.wpengine.com/resources/?_sft_leadership=culture%2Cemotional-intelligence%2Cleading-change
when I output the search variables on the page using your guidance:
<?php
echo $sf_current_query->get_fields_html(
array( “_sft_leadership”, “_sft_management”, “_sft_governance”, “_sft_crosscutting” )
);
?>
I get this result: Leadership: CultureEmotional IntelligenceLeading Change
How do I turn output for user into: Culture, Emotional Intelligence, Leading Change ?
Thank you so much for your help!
– Nina