array( 'name' => __('Trasmissioni'), 'add_new' => __('Aggiungi Trasmissione'), 'new_item' => __('Nuova Trasmissione') ), 'public' => true, 'hierarchical' => false, 'exclude_from_search' => true, 'show_ui' => true, 'show_in_menu' => true, 'menu_position' => 3, 'has_archive' => false, 'supports' => array( 'title', 'editor', 'excerpt', 'thumbnail', 'post-formats' ), 'menu_icon' => 'dashicons-microphone', ) ); } add_action('init', 'create_broadcast_post'); add_action('add_meta_boxes', 'live_meta_box_add'); function live_meta_box_add() { //give name of your input field add_meta_box('orari-dirette', 'ORARI DELLA DIRETTA', 'orari_dirette_input', 'broadcast', 'normal', 'high'); add_meta_box('orari-repliche', 'ORARI DELLE REPLICHE', 'orari_repliche_input', 'broadcast', 'normal', 'high'); } function orari_dirette_input($post) { $values = get_post_custom($post->ID); $onair_day = isset($values['on_air_day']) ? esc_attr($values['on_air_day'][0]) : ''; $text_start = isset($values['on_air_start']) ? esc_attr($values['on_air_start'][0]) : ''; $text_end = isset($values['on_air_end']) ? esc_attr($values['on_air_end'][0]) : ''; $broadcast = term_exists('Podcast', 'category', 0); $old_term = term_exists($post->post_title, 'category', $broadcast); wp_nonce_field('on_air_nonce', 'onair_nonce'); ?>
Lunedì

Martedì

Mercoledì

Giovedì

Venerdì

Sabato

Sabato
ID); $text_start = array(); $text_end = array(); wp_nonce_field('rerun_nonce', 're_run_nonce'); for ($x=0;$x<7;$x++) : $rerun_day[$x] = isset($values['rerun_day_'.$x]) ? esc_attr($values['rerun_day_'.$x][0]) : ''; $text_start[$x] = isset($values['rerun_start_'.$x]) ? esc_attr($values['rerun_start_'.$x][0]) : ''; $text_end[$x] = isset($values['rerun_end_'.$x]) ? esc_attr($values['rerun_end_'.$x][0]) : ''; ?>

Replica n.

'; print_r($_POST); echo ''; exit(); */ // now we can actually save the data $allowed = array( 'a' => array( // on allow a tags 'href' => array() // and those anchords can only have href attribute ) ); if (isset($_POST['on_air_start'])) { $broadcast = term_exists('Podcast', 'category', 0); $check = term_exists(intval($_POST['taxonomy_id']), 'category', $broadcast['term_id']); if (intval($check['term_id']) > 0) { $args = array( 'cat_ID' => intval($check['term_id']), 'taxonomy' => 'category', 'cat_name' => $_POST['post_title'], 'category_description' => '', 'category_nicename' => $_POST['post_name'], 'category_parent' => $broadcast['term_id'] ); $test = wp_insert_category($args); } else { $args = array( 'parent' => $broadcast['term_id'], 'slug' => strtolower(wp_specialchars(str_replace(" ", "-", $_POST['post_title']))), ); wp_insert_term($_POST['post_title'], 'category', $args); } update_post_meta($post_id, 'taxonomy_id', wp_kses($_POST['taxonomy_id'], $allowed)); update_post_meta($post_id, 'on_air_day', wp_kses($_POST['on_air_day'], $allowed)); update_post_meta($post_id, 'on_air_start', wp_kses($_POST['on_air_start'], $allowed)); update_post_meta($post_id, 'on_air_end', wp_kses($_POST['on_air_end'], $allowed)); for ($x=0;$x<7;$x++) { update_post_meta($post_id, 'rerun_day_'.$x, wp_kses($_POST['rerun_day_'.$x], $allowed)); update_post_meta($post_id, 'rerun_start_'.$x, wp_kses($_POST['rerun_start_'.$x], $allowed)); update_post_meta($post_id, 'rerun_end_'.$x, wp_kses($_POST['rerun_end_'.$x], $allowed)); } } }