I have a page with a simple YouTube embed. I would like the client to be able to easily switch the video id from the dashboard without having to edit any templates.
Something like this: <iframe width="576" height="324" src="http://www.youtube.com/embed/<?=$video_id ?>"></iframe>
So I'm trying to insert a metabox in the home page of the respective custom post type (see below) but am not sure how to go about it.
Is something like this possible? If not, is there a way to insert a metabox into the 'home' dashboard page of the WordPress dashboard? I'm open to any suggestions as well. Thank you. - Update -
This is what I currently have in my functions.php:
// YouTube Metabox
add_action('wp_dashboard_setup', 'custom_dashbox');
function custom_dashbox() {
global $wp_meta_boxes;
wp_add_dashboard_widget('widget_slug','Featured Video', 'widget_display','widget_submission');
}
function widget_display() {
echo '<label><small>YouTube ID</small></label><br /><br /><input type="text" name="youtube_id" /><br/><br />
<input type="submit" name="submit_youtube" />';
}
function widget_submit() {
//Do what you need to do with your youtube id possibly:
if (get_option('youtubeid'))
{
update_option('youtubeid',$_POST['youtube_id']);
}
else {
add_option('youtubeid',$_POST['youtube_id']);
}
}