Take the 2-minute tour ×
WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

I'd like to add a meta box to my posts and page editor that will allow me to upload an image and use it as sort of a SECOND featured image. The idea is that my client will be able to upload an image to this meta box to customize the page/posts header image.

Here is an example of what the final result would be: http://gointrigue.com/locations-and-dates/

As you can see at the top of the page there is a large banner of a dancer. Right now this is hardcoded with CSS. I'd like for this to instead be editable by my client from within the Wordpress post/page edit screen on a per page and per post basis.

How do I get started?

share|improve this question

6 Answers 6

up vote 3 down vote accepted

The functionality you want may be built from scratch but definitely a custom fields plugin will make your life much easier.

I use Advanced Custom Fields, and it gives amazing results and the possibilities are endless.

I haven't used this one, but it seems pretty good too.

share|improve this answer
    
I do use ACF for every Wordpress I'm working on and it will fit your needs (and much much more) perfectly –  Kaaviar Mar 22 '12 at 12:25
    
Correction: what @Norcross offers is not a plugin, is a Class, and it is really 1st class for theme developers. –  brasofilo May 18 '12 at 11:15

You can use this plugin http://wordpress.org/extend/plugins/multiple-post-thumbnails/ to add secondary featured image to page/posts header image.

share|improve this answer
    
I also use the Multiple Post Thumbnails plugins mentioned in a previous response and would recommend that as a good solution in this instance. –  Ben Huson Mar 22 '12 at 11:42

I'm one of the developers that maintains this metabox class. it includes an upload field that you can use.

https://github.com/jaredatch/Custom-Metaboxes-and-Fields-for-WordPress

share|improve this answer
    
nice! i like this lib –  Ayaz Malik Aug 1 '13 at 23:32

You will have to add a meta box on the post/page edit pages. See the doc for add_meta_box. There is a detailed example here, along with how to handle/save the entered information. In the myplugin_inner_custom_box function, replace the text input with a file upload (and/or more fields if you want to). Handle the $_FILE array in the myplugin_save_postdata function.

share|improve this answer

use this "Meta Box Script For WordPress" http://www.deluxeblogtips.com/meta-box-script-for-wordpress/

share|improve this answer

There are a number of plugins and scripts that others have referenced. The two I prefer as a developer are Meta Box and the Meta Box Class. Both of these do require that you mess with code to set the fields up, but if you are adding custom meta, you will be messing with code to display it anyway.

Advanced Custom Fields is a nice plugin for smaller needs and does allow the addition of new fields on the fly, but each field ( and sub-field - repeaters ) is added as a unique field and for each field you add, the plugin adds 2 fields to the database ( the second being an identifier assigned by ACF. ) So if you are doing a query on a page to get 10 fields, you will actually be doing 20 database queries ( plus one more by ACF ) which can really add to DB query bloat. Use this one carefully.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.