Question

I need a Webinar in my wordpress site. So I'm registering an meta box for my custom post type. I can see my custom post in the wordpress admin panel, but inside the custom post meta box is missing. What is wrong here!

// Meta boxes
add_filter( 'rwmb_meta_boxes', 'navbig_webinars_register_meta_boxes' );

//Register meta boxes
function navbig_webinars_register_meta_boxes( $meta_boxes )
{
    $prefix = 'navbig_webinars_';

$meta_boxes[] = array(

    'id' => 'standard',

    'title' => __( 'Webinar Data', 'rwmb' ),

    'pages' => array( 'webinar' ),

    'context' => 'normal',

    'priority' => 'high',

    'autosave' => true,

    'fields' => array(

        array(
            'name' => __( 'Date of Webinar', 'rwmb' ),
            'id'   => "webinar_date",
            'type' => 'date',

            // jQuery date picker options. See here http://api.jqueryui.com/datepicker
            'js_options' => array(
                'dateFormat'      => __( 'dd-MM-yy', 'rwmb' ),
                'changeMonth'     => true,
                'changeYear'      => true,
                'showButtonPanel' => true,
            ),
        ),

        array(

            'name'  => __( 'Location', 'rwmb' ),
            'id'    => "webinar-location",
            'type'  => 'text',
            'std'   => __( 'Default text value', 'rwmb' ),

        ),

        array(
            'name' => __( 'Time Of Webinar', 'rwmb' ),
            'id'   => 'webinar_time',
            'type' => 'time',
            'js_options' => array(
                'stepMinute' => 5,
                'showSecond' => true,
                'stepSecond' => 10,
            ),
        ),
        array(
            'name'     => __( 'Select Time Zone', 'rwmb' ),
            'id'       => "select-timezone",
            'type'     => 'select_advanced',
            'options'  => array(
                'value1' => __( 'PST', 'rwmb' ),
                'value2' => __( 'EST', 'rwmb' ),
            ),
            'multiple'    => false,
            'placeholder' => __( 'Select an Coures Type', 'rwmb' ),
        ),
        // URL
        array(
            'name'  => __( 'Webinar URL', 'rwmb' ),
            'id'    => "webinar_url",
            'type'  => 'url',
            'std'   => 'http://google.com',
        ),

        array(
            'name' => __( 'Webinar Banner', 'rwmb' ),
            'id'   => "webinar_banner",
            'type' => 'thickbox_image',

        ),

    ),

);


    return $meta_boxes;
}
Was it helpful?

Solution

You can find more detail about meta boxes here.

Here is sample add_meta_box code:-

add_meta_box(
    'some_meta_box_name'
    ,__( 'Some Meta Box Headline', 'plugin_textdomain' )
    ,'render_meta_box_content' //this is callback function.
    ,'post_type'
    ,'advanced'
    ,'high'
);
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top