This will create a metabox for you to enter a video code.
//Creating a MetaBox for Posts to enter Video Code.
add_action('add_meta_boxes','video_meta_box');
function video_meta_box(){
add_meta_box('video_box_id', 'Enter Video ' , 'video_box_cb','post','normal','default');
}
function video_box_cb($post){
$value = get_post_meta($post->ID,'video_box',true);
echo '<textarea rows="4" cols="50" id="video_box", name="video_box">';
echo $value;
echo '</textarea>';
}
add_action('save_post','save_video_box');
function save_video_box($post_id){
$box_data = $_POST['video_box'];
update_post_meta($post_id,'video_box',$box_data);
}
Use this code to render this code within your theme.
<?php
$custom_values = get_post_custom($post->ID);
echo '<p> Video CODE: '.$custom_values['video_box'][0].'</p>';
?>
Related Posts:
- meta_box or custom_field as a second tinymce post-instance?
- Automatic value for custom fields for posts
- Understanding and using metaboxes in posts
- How to I retrieve the ID from the Posts page?
- Hide custom metabox value from custom fields
- Get post meta retrieving wrong value
- Why my meta boxes won’t show in front post page?
- Display content between two dates?
- Adding an option to post editor to show a site disclaimer or message
- How can I create a menu items from meta box based on users input
- How to protect pages with double authentication: password + email (in custom field)
- How set featured posts using checkbox in post edit screen?
- How can I retrieve multiple get_post_meta values efficiently?
- Add a checkbox to post screen that adds a class to the title
- Can I force a metabox to be in one column?
- Custom Field in Featured image for A particular post
- How to add a new tab to page editor
- Listen to Post action
- How can I add a column/s to wp_posts table?
- How to add metabox for post of specific category
- Convert custom fields to post categories
- Update all posts automatically when using post_meta
- How to batch update post content with custom post meta value
- upload image in a meta box
- I am trying to create a simple frontend form for posting
- Prevent duplicate posts in wp_insert_post using custom fields
- HTML code in Custom field
- Better post meta efficiency?
- How to show posts rank based on custom field value
- Add custom field to all posts in specific category
- Adding a Nav menu to post admin
- 1 column admin screen options – move submitdiv to bottom
- Guest Author – How to modify my custom function code if the guest author URL will follow a particular pattern/format?
- multicheck box for post metabox
- add_meta_box: Datepicker like the one for postdate?
- Paragraphs removed when using get_post_custom()?
- get_post_custom stripping styling issue
- Change post format using custom field
- Have save_post write to database image meta [closed]
- Populating a page with content from post custom fields
- How to change what the post creation page looks like?
- Multiple information using custom post type
- Sanitizing `wp_editor();` Values for Database, Edit, and Display
- How can I make existing custom fields easier to edit/add in my theme?
- What Can I Use To Add A Custom Button Between Publish button and Move To Trash?
- Add custom fields to post programmatically
- How to get Advanced Custom Field Value According using POST ID? [closed]
- Using radio button meta data from a custom meta box
- Save list from a custom meta box?
- Using Custom Posts with Metaboxes and Drop-downs
- Autoremove empty custom fields
- How to add a custom field after wp post
- Custom fields on a virtual page
- What Is meta_id In wp_postmeta?
- Get a custom field of all posts on current blog page
- Only display posts after current date
- Add custom field automatically (add_post_meta) with value based on number of words of article
- Global $post not working in OOP function WordPress
- How can I get a post field value using javascript?
- How to rename “Publish” metabox title in post screen
- Adding dropdown select meta box to custom post type – seems restAPI is interfering
- Duplicating Table of Contents for Paginated Post
- Dashboard :10 Last draft page and 10 last pending review page (metabox)
- Guest Author – How to display posts on /author/ archive page
- WP_Query orderby not working with meta_value_num and menu_order
- How can I sort posts by the date and a custom meta field?
- How do I correctly set up a WP-Query to only show upcoming event-posts?
- How to display Common posts from specific Tag & Category with Shortcode
- Adding custom fields to bbpress reply form
- Automatically add custom fields value to wordpress post
- Meta value does not save for scheduled posts
- Is there a way to notify specific users when new posts are published to specific pages?
- MySql query to get posts with all meta and terms
- Categories list into registration form
- Add a custom meta box in the post options that loads some html code in the header
- Simultaneous admin updates causes custom fields to not update
- Query Posts With Over 1000 Views
- Cannot retrieve a custom RSS field from posts
- Hooking into the post editing screen for an existing page only
- Query Posts by Custom Field
- How to rate a post from Admin Side / Manually?
- Customize rel=canonical tag for single blog post
- How to save meta checkbox WordPress
- Get post ID from a link
- Create a list of posts with topic headdings
- Add field to user meta table in database when link is clicked
- Is there a way to create a meta box that can be added multiple times to a post dynamically?
- Edit multiple custom post types while saving a new or edited post
- Upload attachment from external site
- Show metabox value last post excerpt, title and link
- if in category but only with post meta
- Output Post with ACF Fields into other Post
- Updating post meta for checkbox
- Saving Post Data in Another Database
- Add two custom fields as a default to the “new post” page.
- How can I tell if a post has been published at least once?
- After ajax image is outside the “ tag
- Edit custom fields in posts list
- Add multiple meta keys to a post at once
- WP_Query custom field pass the post id