Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

WordPress

Wordpress Theme Options page media uploader

I'm creating a Theme Options page for my theme in Wordpress. I've gone through the Setting API tutorial and got various input fields working great! One input type I want to include is a media upload field for adding custom images.

I've created a file input field but it isn't saving the choice when I click save! Here's the code using so far:

$options = get_option( 'port_settings' );   
    if( !isset( $options['header_logo'] ) ) $options['header_logo'] = FALSE;
    echo '<input type="file" id="port_header_logo" name="port_settings[header_logo]" value=""' . $options['header_logo'] . '>';

Is there a way to have an upload selector that's linked to the Wordpress Media Library?

Can anyone help?

Austin Whipple
Austin Whipple
29,725 Points

I've cleaned up your question a bit using the proper code block markup. Be sure to check out the Markdown Cheatsheet below the text editor for more information!

Unfortunately, I'm not sure of the best answer for this one, so I've also requested answer from a couple additional folks.