mytechead

Android & Wordpress Help center

WordPress: Add meta box in edit post screen.

Description

The add_meta_box() function was introduced in Version 2.5. It allows plugin developers to add sections to the Write Post, Write Page, and Write Link editing pages.

Usage

 <?php
add_meta_box( $id, $title, $callback, $post_type,

 $context, $priority, $callback_args );
?> 

Parameters

$id
(string) (required) HTML ‘id’ attribute of the edit screen section

Default: None
$title
(string) (required) Title of the edit screen section, visible to user

Default: None
$callback
(callback) (required) Function that prints out the HTML for the edit screen section. Pass function name as a string. Within a class, you can instead pass an array to call one of the class’s methods. See the second example under Examplebelow.

Default: None
$post_type
(string) (required) The type of Write screen on which to show the edit screen section ('post', 'page', 'link', or 'custom_post_type'where custom_post_type is the custom post type slug)

Default: None
$context
(string) (optional) The part of the page where the edit screen section should be shown ('normal', 'advanced', or 'side'). (Note that ‘side’ doesn’t exist before 2.7)

Default: ‘advanced’
$priority
(string) (optional) The priority within the context where the boxes should show ('high', 'core', 'default' or 'low')

Default: ‘default’
$callback_args
(array) (optional) Arguments to pass into your callback function. The callback will receive the $post object and whatever parameters are passed through this variable.

Default: null

References: http://codex.wordpress.org/Function_Reference/add_meta_box

Advertisements

Single Post Navigation

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: