Custom Post type with datepicker metabox

/* Events */
add_action(‘init’, function(){

$labels = array(
‘name’                  => __( ‘Events’,              ZEETEXTDOMAIN ),
‘singular_name’         => __( ‘Event’,               ZEETEXTDOMAIN ),
‘menu_name’             => __( ‘Events’,              ZEETEXTDOMAIN ),
‘all_items’             => __( ‘All Items’,                 ZEETEXTDOMAIN ),
‘add_new’               => __( ‘Add New’,                   ZEETEXTDOMAIN ),
‘add_new_item’          => __( ‘Add New Item’,              ZEETEXTDOMAIN ),
‘edit_item’             => __( ‘Edit Item’,                 ZEETEXTDOMAIN ),
‘new_item’              => __( ‘New Item’,                  ZEETEXTDOMAIN ),
‘view_item’             => __( ‘View Item’,                 ZEETEXTDOMAIN ),
‘search_items’          => __( ‘Search Items’,              ZEETEXTDOMAIN ),
‘not_found’             => __( ‘No item found’,             ZEETEXTDOMAIN ),
‘not_found_in_trash’    => __( ‘No item found in Trash’,    ZEETEXTDOMAIN )
);

$args = array(
‘labels’                => $labels,
‘public’                => true,
‘has_archive’           => false,
‘exclude_from_search’   => true,
//’menu_icon’             => get_template_directory_uri() . ‘/admin/images/icon-event.png’,
‘capability_type’       => ‘post’,
‘supports’              => array(‘title’, ‘editor’, ‘thumbnail’)
);

register_post_type(‘zee_events’, $args);
flush_rewrite_rules();
});

$prefix = ‘events_’;
$fields = array(
array(
‘label’ => __(‘Event Date’, ZEETEXTDOMAIN),
‘id’    => ‘datetimepicker’,
‘type’  => ‘text’,
)
);

new Custom_Add_Meta_Box( ‘zee_testimonial_meta’, __(‘Event Settings’, ZEETEXTDOMAIN), $fields, ‘zee_events’, true );

function datepickerfunction() {
wp_enqueue_script(‘jquery-js’,        get_template_directory_uri() . ‘/assets/js/jquery.js’);
wp_enqueue_script(‘datepicker-js’,        get_template_directory_uri() . ‘/assets/js/jquery.datetimepicker.full.js’);
wp_enqueue_style(‘style’,           get_template_directory_uri() . ‘/assets/css/jquery.datetimepicker.css’);
wp_enqueue_script(‘customdate-js’,        get_template_directory_uri() . ‘/assets/js/customdatepicker.js’);
}
add_action( ‘admin_footer’, ‘datepickerfunction’, 100 );

function my_custom_css(){
echo ‘<style>
#datetimepicker{
width: 310px !important;
}
</style>’;
}
add_action(‘admin_footer’, ‘my_custom_css’);

Advertisements