Support » Fixing WordPress » A Conditional for Empty Content

  • Hi all,

    I am trying to figure something out. I am using Magic Fields to generate a series of tabbed content on pages. It is used outside of the loop. I am trying to find a way to hide the div if there is no content in Magic Fields. Right now, it shows the empty divs which are styled. Not sure of the best way to do this. Thanks!

    Here’s the sample page code.

    [Code moderated as per the Forum Rules. Please use the pastebin]

Viewing 1 replies (of 1 total)
  • I don’t know exactly what you are trying to do since your code was removed by the moderator, but you should be able to assign your get() request to a variable and then check it it’s not empty.

    <?php
      $my_value = get('my_magic_field');
      if ($my_value != '') {
        // do stuff
      }
    ?>
Viewing 1 replies (of 1 total)
  • The topic ‘A Conditional for Empty Content’ is closed to new replies.