X

Add meta boxes

To add custom meta boxes for your custom fields is a great way to simplify the user interface in WordPress.

Adding your own hasn’t been very easy for someone without very much php experience, but using Deluxe Blog Tips Meta box script makes it a whole lot easier.

Download it, and include it using the instructions on their website.

Code Snippet:

<?php
$meta_boxes&#91;&#93; = array(
    'id' => 'personal',                            // meta box id, unique per meta box
    'title' => 'Personal Information',            // meta box title
    'pages' => array('post', 'page', 'album'),    // post types, accept custom post types as well, default is array('post'); optional
    'context' => 'normal',                        // where the meta box appear: normal (default), advanced, side; optional
    'priority' => 'high',                        // order of meta box: high (default), low; optional

    'fields' => array(                            // list of meta fields
        array(
            'name' => 'Full name',                    // field name
            'desc' => 'Format: Firstname Lastname',    // field description, optional
            'id' => $prefix . 'fname',                // field id, i.e. the meta key
            'type' => 'text',                        // text box
            'std' => 'Anh Tran',                    // default value, optional
            'validate_func' => 'check_name'            // validate function, created below, inside RW_Meta_Box_Validate class
        )
    )
);

// Add as many as you want by copy the arrays and naming them $meta_boxes[1], $meta_boxes[2] etc.

foreach ($meta_boxes as $meta_box) {
    new RW_Meta_Box($meta_box);
}
?>

Comments  Leave a Reply

Add a Comment

We're glad you have chosen to leave a comment. Please keep in mind that all comments are moderated according to our privacy policy, and all links are nofollow. Do NOT use keywords in the name field. Let's have a personal and meaningful conversation.

WordPress Launch Checklist

The Ultimate WordPress Launch Checklist

We've compiled all the essential checklist items for your next WordPress website launch into one handy ebook.
Yes, Send Me the Free eBook!