1

I'm wanting to add an area in the Wordpress page editor to display a custom page description in the page headers. Preferably displayed in its won option area similar to the "Page/Post Header Options" below.

enter image description here

I need to be able to have an area where I can just add a small paragraph or so of text. I know html/css enough to find where to stick the codes in the theme editor, but I don't know the php I'd use to do this. Any help is appreciated. Thanks!

0

A simple, easy, and quick way to add your own custom meta box to your Pages is by first installing the Meta Boxes plugin (required). Next, add the following custom code to your functions.php in your child theme:

add_filter( 'rwmb_meta_boxes', 'wpse_236870_meta_boxes' );

function wpse_236870_meta_boxes( $meta_boxes ) { // Add custom meta box in 'Pages'
    $meta_boxes[] = array(
        'title' => __( 'Some Meta Box Title', 'textdomain' ),
        'post_types' => 'page',
        'fields' => array(
            array( // Add custom textbox
                'id'   => 'your_id_here',
                'name' => __( 'Some Title', 'textdomain' ),
                'type' => 'textarea',
            )
        ),
    );
    return $meta_boxes;
}

As a result, you have your custom meta box.

Custom meta box on Pages

The authors of the Meta Boxes plugin have a very extensive documentation which will help you with anything else.

  • How would I then display that information on a page? – tasha double Aug 23 '16 at 20:42
  • That depends where you are going to display this value. Based on the docs, it would looks something like this: <?php echo rwmb_meta( $field_id, $args, $post_id ); ?>. You can see more of the documentation here. – Ethan Jinks O'Sullivan Aug 23 '16 at 20:48
  • 1
    Thanks! It's working! I'd like to note for anyone else that you need to remember to add a function per the meta boxes' docs. :) – tasha double Aug 23 '16 at 20:59

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.