Support » Fixing WordPress » Only display theme option if entry is present?

  • Hi all,

    I am currently using the brilliant NHP theme framework, but I’d like to add the functionality to only display an element if a certain theme option field has data entered into it.

    According to the wiki, the theme options can be displayed using the following methods:

    $options = get_option('option_name');


    echo $options['unique_id'];

    Previously with custom fields I have used this to achieve what I want:

    <?php $blah1 = get_post_meta($post->ID, 'blah_blah_blah', true);
    if (!empty($blah1)) : ?>

    etc. etc.

    But I don’t know how to get this to work with the theme options call.

    Can anyone help please?

    Many thanks.


Viewing 1 replies (of 1 total)
  • what are you trying to do? I mean, if you’re doing

    $this = get_option('option_name');
    if ($this) :
    put html to display here
    <? endif; ?>

    that will only display the text if the option actually returns a result, if it doesn’t, then $this would be equivalent to “” or null, so it’ll be ignored.

Viewing 1 replies (of 1 total)
  • The topic ‘Only display theme option if entry is present?’ is closed to new replies.