Support

Account

Home Forums General Issues ACF Galleries displaying empty Reply To: ACF Galleries displaying empty

  • This will always be true

    
    if ($logos = get_field("as_seen_on_logos", "options")): 
    

    true or false in this case is dependent of if a value is assigned to $logos and that will always happen even if the field has no value.

    You need to get the value and then test the value, as far as I know you cannot do this all in the if, to test you can also display the value to make sure you’re getting what you expect.

    
    $logos = get_field('as_seen_on_logos', 'options');
    echo '<pre>'; var_dump($logos); echo '</pre>'; // test
    if (!empty($logos)) {
      // loop over logos
    }