WordPress.org

Ready to get started?Download WordPress

Forums

OptionTree
[resolved] Using the Upload type (3 posts)

  1. tdschrock
    Member
    Posted 2 years ago #

    I'm trying to use the Upload type for an image on the front page of my site. I've uploaded the file, and clicked on "Add to Option Tree", but I don't see any filename in the box, and I cannot figure how to get the picture displayed on the page. I'm using the code:

    <?php
                   if ( function_exists( 'get_option_tree') ) {
                     echo get_option_tree( 'lbbc_sermon_series_picture' );
                   } ?>
    to display the picture file.

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

  2. tdschrock
    Member
    Posted 2 years ago #

    I figured out something here. I was not echoing the right info into the img src tag. So my code is now...

    if ( function_exists( 'get_option_tree') ) {
                     echo "<img src=";
                     echo get_option_tree( 'lbbc_sermon_series_picture' );
                     echo " />";
                   } ?>

    Then, for the uploading problem I figured out that you have to leave the link url in place for the file url. I was clicking on "None".

  3. Daniel Craig Jallits
    Member
    Posted 2 years ago #

    For anyone else who may come across this. The double quotes need to be escaped in the first and last echo statements. So the code would be as follows:

    <?php
    	if ( function_exists( 'get_option_tree') )
    	{
    		echo "<img src=\"";
    		echo get_option_tree( 'lbbc_sermon_series_picture' );
    		echo "\" />";
    	}
    ?>

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic