You are most likely to save the url of the image and not the whole image tag,
and there is a great tutorial that explains just how to use the media uploader in your own theme or plugin:
http://www.webmaster-source.com/2010/01/08/using-the-wordpress-uploader-in-your-plugin-or-theme/
update
In case of using this in a meta box you will need the post id so change the js code from:
jQuery('#upload_image_button').click(function() {
formfield = jQuery('#upload_image').attr('name');
tb_show('', 'media-upload.php?type=image&TB_iframe=true');
return false;
});
to
jQuery('#upload_image_button').click(function() {
formfield = jQuery('#upload_image').attr('name');
post_id = jQuery('#post_ID').val();
tb_show('', 'media-upload.php?post_id='+post_id+'&type=image&TB_iframe=true');
return false;
});
Related Posts:
- Best practices for a Style/CSS based theme options page?
- Add a page outside of the current theme?
- Switch Theme Through Options Panel
- How to make alert for new version on theme options?
- How to mark an option as selected
- How can I show more than 15 themes at a time in the admin menu?
- How to go about pre generating css file with variables from theme options
- Does uninstalling a WordPress theme delete its database values?
- Cannot find the code for “Edit This” link in posts in a specific theme
- Defining different theme for Blog posts page
- How to set different settings for a mobile theme?
- Disable Theme API / Front end (for API only environment)
- What’s the proper way to include inlined javascript-source?
- How to understand a specific bit of WordPress syntax
- Should a child theme share the same theme options row as the parent, or should it have it’s own options row?
- Creating a theme options page
- How Do I Use A Custom Mobile Theme?
- How can I make some themes usable only by admins?
- Custom options below pages/posts editor?
- Redux callback action
- Preserve theme settings when migrating from local to live
- Functions containing parameter ‘yourtheme’
- What is the “pub” theme? [closed]
- Passing dynamic options from backend to frontend
- Color Options from Theme Customizer API not returning via get_theme_mod()
- Issue with theme mod options during domain migration
- .PO file is found but I don’t see translations: how to debug the problem?
- How to add some php code in header.php using plugin
- WordPress activate theme error $pagenow
- Setting a new default template for the creation of a page
- Cannot update a file for my theme
- List of categories instead of dropdown menu selector in admin options
- Switching among theme customizations
- how to create a section inside a section with theme options customizer
- Incorrect Theme and Upload URLs After Migration
- Warning: call_user_func() expects parameter 1 to be a valid callback
- Create /archive page in WordPress Theme
- Church hope them issue
- How do I change the header image height in Twenty Seventeen?
- Two instances of WordPress with different URLs and themes
- Is “Featured Content” in Twenty Fourteen done with a plugin, or is it native in WP4.0?
- How can I use WordPress as a job board ? (but free)
- Can I Download a Free WordPress Theme, Edit it and Use it?
- Are custom inner theme folders in any way overridable by child themes?
- How to reverse the pagination numbers of an archive?
- In which directory do I find a specific HTML code of my wordpress page? Some of it seems to be missing after checking all pages [closed]
- Why do Trackbacks/Pingbacks not appear below my posts/pages?
- Extra themes – ok or bad?
- Theme Customizer – How to create a sub panel
- Setting a static home page and blog page without using the settings
- Use a different template/theme if mobile only on home page
- Can i have a single wordpress site to have two themes ( one for pc other for mobiles)
- Translated my theme (translation not showing up)
- How to use get_page_by_title() with qTranslate?
- Changing $before_widget for certain widgets
- Multi-level page hierarchy
- Can I have two different theme for two different language?
- loss of theme options while site deployment in production
- How to install WordPress theme and configure it? [closed]
- How do I get rid of or change the footer in my child theme?
- There is any way to remove post-format filter? [closed]
- Categories gone after changing theme / demos [closed]
- Own Theme Customizer displays error message when saving, saving still works
- 1 Database for multiple WordPress themes
- Page has a parent and $post->post_parent returns 0
- How to create different navigation for registered users in WooThemes Canvas?
- Selected template is not respected for home page in WordPress
- WordPress without a theme – help!
- How to install themes with the demo content?
- Jetpack CSS .screen-reader-text breaks mobile menu [closed]
- Error when using ‘continue reading’
- How to update theme to specific version
- Configure new installed WordPress in live server
- Where does WordPress get the theme name from to check for updates?
- Hi everybody, I have a problem of search box
- Updating WordPress Theme Files
- help needed for suit designing tool
- Multiple sub directories for theme template pages
- How to get the theme directory URI?
- My blog suddenly can’t find my stylesheet?
- How to fix Scrape key check failed on WordPress VPS?
- Customizer API Multi Sections in single Panel
- How to use my .mo file in the Divi child theme instead of file in a parent /builder directory?
- How to fix Gutenberg with SiteOrigin page builder deleting content when editing
- How to allow users to switch to the child theme from front end without plugin?
- Change whole theme depending on resolution
- post_prev & post_next within same category
- Costum Theme template directoy url problem
- How to remove the option data of a theme when that theme is removed?
- How to find out which template the HTML content comes from?
- Convert theme to be based on Bootstrap?
- Include root files into header files
- Static posts page is not working
- Cannot use some themes within Managed WordPress of Go Daddy [closed]
- How to track your theme usage on the internet?
- How to add Company Logo to Chosen Theme
- What security risk is not having “default” theme?
- Absolute and relative paths
- Get header/footer list for a theme
- Help!!! Old theme doesn’t load scripts and conflitcs with plugins