I need a way to create a custom field that will let me pick an image from the media gallery. How do I do that?
The custom field should have a button that when clicked will take me to the media gallery and place the src destination url within a input text box.
looking for a plugin or online tutorial and I’m having little luck.
A few weeks ago I added a feature similar to Magic Fields.
Here’s the github project. The most important thing is in this file:
js/custom_fields/media_image.js
By using one of the plugins that already do this:
http://wordpress.org/extend/plugins/custom-field-template/
This to me sounds like the post_thumbnail feature in WordPress. It will add a box on the right hand side, below the tag box. By default the box displays a link “Set featured image”.
When you click on it the media gallery popup opens and you can pick a picture you have previously uploaded to the post as the featured picture.
You can then use:
in you theme to display the featured picture.
To enable post_thumbnail you just need to add:
to your theme’s function.php
To answer your question a bit sideways, are you open to an alternative? I suggest adding a photo to a post, filing the post under a specific category for your images, and maybe, depending on your needs, adding a text-only custom field to retrieve that specific image.
Just a thought…