clare485
12/3/2013 - 2:46 PM

custom meta boxes

custom meta boxes

  <?php if ( get_post_meta($post->ID, 'leven_right_hand_sidebar', true) ) : ?>

                <div class="meta-sidebar">
                    <?php echo do_shortcode(rwmb_meta( 'leven_right_hand_sidebar' )); ?>
                 </div>

            <?php endif; ?>
<?php
/*
 * add meta boxes
 */
add_action( 'admin_init', 'rw_register_meta_boxes' );

function rw_register_meta_boxes()
{
    if ( !class_exists( 'RW_Meta_Box' ) )
        return;
    $prefix = 'leven_';
    $meta_boxes = array();
    // 1st meta box
    $meta_boxes[] = array(
        'title'    => 'Right hand sidebar',
        'pages'    => array( 'page' ),
        'fields' => array(
            array(
                'name' => 'Right hand sidebar',
                'desc' => '',
                'id'   => $prefix . 'right_hand_sidebar',
                'type' => 'wysiwyg',
            ),
           
             
        )
    );
    
       // testimonials
    $meta_boxes[] = array(
        'title'    => 'Add property link',
        'pages'    => array( 'testimonial' ),
        'fields' => array(
            array(
                'name' => 'Add name of property that this testimonial relates to eg "Helen stayed at Citadene Prestige in Kensington" Add link using link icon in wysiwyg box',
                'id'   => $prefix . 'property_name',
                'type' => 'wysiwyg',
            ),
            
             
        )
    );
    foreach ( $meta_boxes as $meta_box ) {
        new RW_Meta_Box( $meta_box );
    }
}
require_once 'inc/custom_meta_boxes/custom-meta-boxes.php';
require_once 'inc/custom_meta_boxes/page_meta_box.php';
http://wordpress.org/plugins/meta-box/

https://github.com/humanmade/Custom-Meta-Boxes