File manager - Edit - /home/verseaumee/middletvnew26/wp-content/plugins/Archive/includes/meta-boxes.php
Back
<?php if(!defined('ABSPATH'))exit; function mtvc_add_meta_boxes(){ add_meta_box('mtvc_ticker','Réglages de l’information','mtvc_ticker_box','mtv_ticker','normal','high'); add_meta_box('mtvc_banner','Contenu de la bannière','mtvc_banner_box','mtv_banner','normal','high'); add_meta_box('mtvc_program','Détails du programme','mtvc_program_box','mtv_program','normal','high'); } add_action('add_meta_boxes','mtvc_add_meta_boxes'); function mtvc_field($id,$label,$type='text',$placeholder=''){ $v=get_post_meta(get_the_ID(),$id,true); echo '<p><label><strong>'.esc_html($label).'</strong></label><br>'; if($type==='textarea')echo '<textarea class="widefat" rows="3" name="'.esc_attr($id).'">'.esc_textarea($v).'</textarea>';else echo '<input class="widefat" type="'.esc_attr($type).'" name="'.esc_attr($id).'" value="'.esc_attr($v).'" placeholder="'.esc_attr($placeholder).'">'; echo '</p>'; } function mtvc_ticker_box(){wp_nonce_field('mtvc_save','mtvc_nonce');mtvc_field('_mtvc_link','Lien facultatif','url');mtvc_field('_mtvc_active','Actif (1 = oui)','number','1');} function mtvc_banner_box(){wp_nonce_field('mtvc_save','mtvc_nonce');mtvc_field('_mtvc_subtitle','Sous-titre');mtvc_field('_mtvc_button_text','Texte du bouton');mtvc_field('_mtvc_button_url','Lien du bouton','url');mtvc_field('_mtvc_mobile_image','URL image mobile','url');mtvc_field('_mtvc_position','Position : left, center ou right');mtvc_field('_mtvc_overlay','Opacité du calque (0 à 0.9)','number','0.35');} function mtvc_program_box(){wp_nonce_field('mtvc_save','mtvc_nonce');mtvc_field('_mtvc_start','Heure de début','time');mtvc_field('_mtvc_end','Heure de fin','time');mtvc_field('_mtvc_status','Statut affiché','text','EN COURS');} function mtvc_save_meta($post_id){if(!isset($_POST['mtvc_nonce'])||!wp_verify_nonce($_POST['mtvc_nonce'],'mtvc_save')||defined('DOING_AUTOSAVE')&&DOING_AUTOSAVE||!current_user_can('edit_post',$post_id))return;foreach($_POST as $k=>$v)if(strpos($k,'_mtvc_')===0)update_post_meta($post_id,$k,sanitize_text_field(wp_unslash($v)));} add_action('save_post','mtvc_save_meta');
| ver. 1.4 |
Github
|
.
| PHP 8.5.7 | Generation time: 0 |
proxy
|
phpinfo
|
Settings