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 to add version of style.css in wordpress
- What is the role and history of the $content_width global variable?
- Override parent theme translation on child theme
- WordPress API Menu/Submenu Order
- How to set thumbnail image for a (child) theme
- Categorising themes by folders in backend
- Custom Taxonomy-specific JavaScript
- Removing Shortcodes from Child Theme
- A minimalistic admin theme for a WP 3 install
- The style.css stylesheet doesn’t contain a valid theme header
- Load a theme based on browser detection
- How to avoid loading style.css twice in child-theme?
- Change Default Image HTML
- why does bones theme call the_excerpt function with parameters?
- How can I develop a new theme in WordPress without disrupting the current site
- Generating the ogp tags in theme
- Move custom code out of theme’s functions.php file
- Error message “The page you are looking for is temporarily unavailable.” after editing a file [closed]
- Adding goodies to themes
- WordPress Backup
- A hook that runs only when the theme is previewed
- WordPress theme with multiple color schemes
- How can I have case-sensitive theme directory names when installed with Composer?
- Problem in theme installing?
- How to trigger function on theme delete?
- Is there a way to activate different theme for specified users? [closed]
- Theme information in style.css being corrupted
- Toolbar/topbar missing on homepage only?
- Two Navigation Menus – secondary nav is including main nav
- Overwriting templates in child theme and performance
- Themes—Child Themes
- Protect changes made to the theme when updating
- When can changing a theme damage a website?
- Display a specific dynamic sidebar widgets on a specific page
- how to add custom fields in page
- My scripts-bundle.js file is getting sent to the browser as a stylesheet css file. Help!
- Child theme Page Template not loading
- What is the major difference between child theme and normal theme
- variables in translatable text
- Set WordPress Default Template
- Load a different theme for IE less than 9
- Theme Check reporting an incorrect theme slug and text domain
- Understanding Theme specific Code
- get_option in header.php not returning value from customizer
- Internal error 500 accessing Theme > Customize
- How to merge two WordPress themes?
- Style the archives/category sidebar widget via theme
- I get the following message The uploaded file could not be moved to /home/reascom/public_html/wp-content/uploads/2012/07 [closed]
- Custom CSS doesn’t work in edit mode
- Remove transparancy in Sydney theme’s headerimage
- Browser back button does not work on firefox and safari [closed]
- Twenty fifteen theme – change responsive menu condition
- Getting 503 on various files
- Port existing Bootstrap site to WordPress?
- stylesheet is not readable error after installation
- How to enqueue javascript for WP Customize options sidebar?
- How to clone a theme template from within WordPress? [closed]
- Disabling Full Site Editor (FSE)
- get_post_meta() doesn’t allow email
- How to change database entries due to theme change
- WordPress Editor Missing Padding and Background Color?
- What do you call the content area with a “raised” drop-shadow effect? [closed]