WordPress.org

Ready to get started?Download WordPress

Forums

OptionTree
OptionTree "if filled"-type Option? (2 posts)

  1. techteenager
    Member
    Posted 2 years ago #

    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.

    Thanks,
    Matt

    http://wordpress.org/extend/plugins/option-tree/

  2. Syamil MJ
    Member
    Posted 2 years ago #

    empty value will return false, like so:

    <?php if (get_option_tree( 'example')) { ?>
         Follow <?php get_option_tree( 'example', '', true ); ?> on Twiter.
    <? } ?>

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic