Forums Forums Search & Filter Pro I need to output taxonomy terms separated by comma

Viewing 6 posts - 1 through 6 (of 6 total)
  • Anonymous
    #26393

    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

    Ross Moderator
    #26581

    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

    Anonymous
    #26674

    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

    Ross Moderator
    #26753

    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

    Anonymous
    #26784

    Thank you again Ross!

    Getting really closer to desired output.
    I was able to output results. I did not want to show All when nothing is selected for one of the fields,
    so I changed “show_all_if_empty” => false

    What still does not work for me is “delim is the delimiter between the actual options selected within a field” – options continue to come glued together.

    Here is an example of two options chosen for each of two fields:
    Leadership: CommunicationLeading Change
    Governance: AccountabilityStewardship of Resources

    Thank you for your continued guidance!
    Nina

    Anonymous
    #26785

    Sorry, I was wrong.
    I lost track between several servers and I forgot to update the plugin on my testing server.
    My apologies.

    Delimiters are coming properly.

    Thank you again Ross!

Viewing 6 posts - 1 through 6 (of 6 total)