WordPress.org

Support

Support » Plugins and Hacks » OptionTree » [Resolved] [Plugin: OptionTree] Call Select Field options

[Resolved] [Plugin: OptionTree] Call Select Field options

Viewing 5 replies - 1 through 5 (of 5 total)
  • please anyone?

    Plugin Author Derek Herman

    @valendesigns

    I don’t understand the question, can you please rephrase it?

    Im using a select field in my options, how do i call it in the theme if im using only 2 options Yes, and No

    Plugin Author Derek Herman

    @valendesigns

    This code will get you started:

    if ( function_exists( 'get_option_tree' ) ) {
      $select = get_option_tree('select');
      if ( 'yes' == $select ) {
        echo 'Yes';
      } else if ( 'no' == $select) {
        echo 'No';
      } else {
        echo 'Nothing';
      }
    }

    OR

    if ( function_exists( 'get_option_tree' ) ) {
      echo ( $select = get_option_tree('select') == 'yes' ) ? 'Yes' : 'No';
    }

    If you’re not worried if OptionTree is installed then:

    echo ( $select = get_option_tree('select') == 'yes' ) ? 'Yes' : 'No';

    You’ll need to update the select id.

    perfect, thanks.

Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘[Resolved] [Plugin: OptionTree] Call Select Field options’ is closed to new replies.
Skip to toolbar