• Hi, I am facing a problem with Option tree plugin. I want to create dynamic logo uploader. I used option tree plugin. Logo is uploaded successfully. But when it is retrieved nothing show on image section. Its only show an image sign. When I checked it via inspect element on browser its show two image source. Thats why it can not be retrieved.
    I attached here all code which I used.

    Function.php:

    add_filter('ot_show_pages','__return_false');
    add_filter('ot_show_new_layout','__return_false');
    add_filter('ot_theme_mode','__return_true');
    include_once('option-tree/ot-loader.php');
    include_once('includes/theme-options.php');
    theme-options.php:
    <?php
    
    add_action( 'admin_init', 'custom_theme_options', 1 );
    
    function custom_theme_options() {
    
      $saved_settings = get_option( 'option_tree_settings', array() );
    
      $custom_settings = array(
        'sections'        => array(
          array(
            'id'          => 'general',
            'title'       => 'Site Settings'
    
        ),
    	 array(
            'id'          => 'logo',
            'title'       => 'Logo Upload'
          )
        ),
        'settings'        => array(
          array(
            'id'          => 'logo_uploder',
            'label'       => 'Upload Your Logo',
            'desc'        => 'Upload your logo here only image file',
            'type'        => 'upload',
            'section'     => 'general'
          )
    	 )
    );
    
      if ( $saved_settings !== $custom_settings ) {
        update_option( 'option_tree_settings', $custom_settings );
      }
    
    }
     ?>
    then where i want to show:
    <div class="fix-header">
    <?php if( function_exists('get_option_tree')): if (get_option_tree('logo_uploder')): ?>
    <a>"><img src="<?php echo get_option_tree('logo_uploder', '','true'); ?>"/></a>
    <?php else: ?>
    <a>"><img src="<?php echo get_template_directory_uri(); ?>/img/logo.png"/></a>
    <?php endif; endif;?>
    </div>

    Please help me to fix it.

The topic ‘Option tree plugin’ is closed to new replies.