Assuming that your site front page is displaying a static page, the reason that your meta data doesn’t appear on the site front page is because you only enable your post custom meta box for post
post-types:
$meta_box = array(
// ...
// refer to this array key
'page' => 'post',
// ...
);
// ...
function mytheme_add_box() {
global $meta_box;
add_meta_box(
$meta_box['id'],
$meta_box['title'],
'mytheme_show_box',
// Refer to this parameter, which tells
// WordPress that this meta box applies
// to the post post-type
$meta_box['page'],
$meta_box['context'],
$meta_box['priority']);
}
// ...
// Refer to this hook, that tells WordPress
// to hook your save post meta callback into
// the save action for the post post-type
add_action('save_post', 'mytheme_save_data');
To use this same post custom meta also on the page
post-type, you’ll need to call add_meta_box()
for both post
and page
, and you’ll need to hook your save post meta callback into both save_post
and save_page
. (Note: you’ll also want to hook into draft_post
and draft_page
to spare yourself headaches caused by auto-saves.