Hello! A while back I had a question about displaying the terms that a user had chosen to filter their search by, and we’re using this:
<?php global $searchandfilter;
$sf_current_query = $searchandfilter->get(15)->current_query()->get_array();
echo '<strong>Filtered by:</strong>';
foreach($sf_current_query as $key) {
echo ' • ' . $key['active_terms'][0]['name'] . ' ';
}
?>
Which works perfectly except that it’s blank when no terms have been selected, so the user sees “Filtered by:” and nothing else.
Can I add to the php above, using an if / else combo?
So:
if $sf_current_query is blank {
echo 'all';
else foreach($sf_current_query as $key) {
echo ' • ' . $key['active_terms'][0]['name'] . ' ';
} ?>
The “if” bit is where I’m lost – please help!