Support » Plugin: OptionTree » OptionTree "if filled"-type Option?

  • Hello, I just wanted to thank you right off the bat for this awesome pluton. I love designing themes but have little knowledge in complex php so it really helps. I have one (possibly simple) question: is there any way I can use a function that checks if an OptionTree field is filled out, and if it is, display certain code? (Like PHP if?)

    An application would be something like if a user enters their Twitter username in the options then the function would display a “Follow […] on Twitter,” otherwise if the Twitter username field was blank the ‘follow’ button wouldn’t appear.


Viewing 1 replies (of 1 total)
  • empty value will return false, like so:

    <?php if (get_option_tree( 'example')) { ?>
         Follow <?php get_option_tree( 'example', '', true ); ?> on Twiter.
    <? } ?>
Viewing 1 replies (of 1 total)
  • The topic ‘OptionTree "if filled"-type Option?’ is closed to new replies.