Forums Forums Search & Filter Pro Breadcrumbs Revisited – Hoping for Confirmation

Viewing 4 posts - 1 through 4 (of 4 total)
  • Trevor
    #154721

    If the query is empty, the $sf_current_query array will be empty, so you can use the PHP empty() function:

    if ( empty($sf_current_query ) ) {
      echo 'Nothing here folks.';
    } else {
    ....
    }

    I would think.

    Anonymous
    #154736

    Unfortunately that’s a no-go. The complete code I put in (using your good chunk there) looked like:

    <?php global $searchandfilter;
     
    $sf_current_query = $searchandfilter->get(15)->current_query()->get_array();
    echo '<strong>Filtered by:</strong>';
    
    if ( is_empty($sf_current_query ) ) {
      echo "all";
    } else {
      foreach($sf_current_query as $key) {
      echo '&nbsp; &bull; ' . $key['active_terms'][0]['name'] . ' ';
    }	
    }?>

    Am I missing something above if? Feels like that’s maybe where I’m off?
    (The page does not display anything – no sidebar, no search form, so as-is above it pretty broken – did I close off the function properly?)

    Trevor
    #154773

    My bad. It was late when I wrote that.

    The function is just empty() not is_empty()

    Anonymous
    #154866

    Perfect, thank you!

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