Title: [Plugin: OptionTree] If  else
Last modified: August 19, 2016

---

# [Plugin: OptionTree] If else

 *  Resolved [toptopych](https://wordpress.org/support/users/toptopych/)
 * (@toptopych)
 * [15 years, 7 months ago](https://wordpress.org/support/topic/plugin-optiontree-if-else/)
 * Hi Derek
 * I’m trying to do the following:
 *     ```
       <?php if ( function_exists( 'get_option_tree') ) :
   
       	if( get_option_tree( 'file_upload') ) : ?>
   
       	<img src="<?php get_option_tree( 'file_upload' ); ?>" />
   
       <?php else : ?>
   
       	<h1> No Options, Man!</h1>
   
       <?php
       	endif;
       endif; ?>
       ```
   
 * But if file is uploaded, no value returns. In html code I see only `img src=""`
   without URL to the image.
 * I’m not very familiar with php, so I would like to ask you to show me working
   example, please. 🙂
 * [http://wordpress.org/extend/plugins/option-tree/](http://wordpress.org/extend/plugins/option-tree/)

Viewing 3 replies - 1 through 3 (of 3 total)

 *  Thread Starter [toptopych](https://wordpress.org/support/users/toptopych/)
 * (@toptopych)
 * [15 years, 7 months ago](https://wordpress.org/support/topic/plugin-optiontree-if-else/#post-1731267)
 * I’ve changed it a bit and now it works:
 *     ```
       <?php if ( function_exists( 'get_option_tree') ) :
   
       	if( get_option_tree( 'file_upload') ) : ?>
   
       	<img src="<?php get_option_tree( 'file_upload', '', 'true' ); ?>" />
   
       <?php else : ?>
   
       	<h1> No Options, Man!</h1>
   
       <?php
       	endif;
       endif; ?>
       ```
   
 * But is that correct? 🙂
 *  [_rg_](https://wordpress.org/support/users/arriba/)
 * (@arriba)
 * [15 years, 7 months ago](https://wordpress.org/support/topic/plugin-optiontree-if-else/#post-1731475)
 * The get_option_tree “returns” a value. You need to “echo” that value, this way:
 * echo get_option_tree(…..
 *  Plugin Author [Derek Herman](https://wordpress.org/support/users/valendesigns/)
 * (@valendesigns)
 * [15 years, 7 months ago](https://wordpress.org/support/topic/plugin-optiontree-if-else/#post-1731543)
 * _rg_ is right, but both options are correct. You can either echo out the returned
   value or have the function do it for you. Either way is going to echo the uploaded
   files URI. However, the option _rg_ is showing above is going to be the least
   code.

Viewing 3 replies - 1 through 3 (of 3 total)

The topic ‘[Plugin: OptionTree] If else’ is closed to new replies.

 * ![](https://s.w.org/plugins/geopattern-icon/option-tree_363534.svg)
 * [OptionTree](https://wordpress.org/plugins/option-tree/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/option-tree/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/option-tree/)
 * [Active Topics](https://wordpress.org/support/plugin/option-tree/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/option-tree/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/option-tree/reviews/)

 * 3 replies
 * 3 participants
 * Last reply from: [Derek Herman](https://wordpress.org/support/users/valendesigns/)
 * Last activity: [15 years, 7 months ago](https://wordpress.org/support/topic/plugin-optiontree-if-else/#post-1731543)
 * Status: resolved