I basically want to have a custom CMS page that has pairs of images and labels for those images defined within it. I intend to use these pairs of items for populating conte
I used @brasofilo's answer above, however I really missed having the image ID saved as well, so I could use wp_get_attachment_imagefor example.
So here's my revised code, which also saves the image ID. I also use two arrays to define on which page templates and respectively on which post types the meta box appears. Here's the code:
ID, '_wp_page_template', true ), $rep_fields_templates ) ) {
add_meta_box(
'post_gallery',
'Slideshow Gallery',
'post_gallery_options_so_14445904',
'page',
'normal',
'core'
);
}
}
/**
* Print the Meta Box content
*/
function post_gallery_options_so_14445904()
{
global $post;
$gallery_data = get_post_meta( $post->ID, 'gallery_data', true );
// Use nonce for verification
wp_nonce_field( plugin_basename( __FILE__ ), 'noncename_so_14445904' );
?>
ID ) ) { ?>
Make sure the number if images you add is a multiple of 5.
Here's an example of how you can output the data to your theme.