WordPress.org

Ready to get started?Download WordPress

Forums

OptionTree
[resolved] Call Select Field options (6 posts)

  1. speedofpain
    Member
    Posted 2 years ago #

    What is the php to call the select filed options in theme files.

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

  2. speedofpain
    Member
    Posted 2 years ago #

    please anyone?

  3. Derek Herman
    Member
    Plugin Author

    Posted 2 years ago #

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

  4. speedofpain
    Member
    Posted 2 years ago #

    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

  5. Derek Herman
    Member
    Plugin Author

    Posted 2 years ago #

    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.

  6. speedofpain
    Member
    Posted 2 years ago #

    perfect, thanks.

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic