Thursday, February 19, 2015

Creating a meta box for posts Titan Framework



if ( !class_exists( 'TitanFramework' ) && file_exists( dirname( __FILE__ ) . '/titan/titan-framework-embedder.php' ) ) {
    require_once( dirname( __FILE__ ) . '/titan/titan-framework-embedder.php' );
}


function theme_meta_options() {
    $titan = TitanFramework::getInstance( 'pmi' );
    $myMetaBox = $titan->createMetaBox( array(
        'name' => 'Event Option',
        'post_type'  =>array('post')
    ) );

    $myMetaBox->createOption(array(
        'name'  => 'Event Start Date & Time',
        'type'  => 'date',
        'id'    => 'eventdatentime',
        'desc'  => 'Event Data & time',
        'date'  => true,
        'time'  => true
    )) ;


    $myMetaBox->createOption( array(
        'name' => 'Venue',
        'id' => 'event_venue',
        'type' => 'text',
        'desc' => 'Venue Address',

    ) );

    $myMetaBox->createOption(array(
        'name'  => 'End Date & Time',
        'type'  => 'date',
        'id'    => 'eventenddatentime',
        'desc'  => 'Event End Data & time',
        'date'  => true,
        'time'  => true
    )) ;

}

add_action( 'tf_create_options', 'theme_meta_options' );

No comments:

Post a Comment