diff --git a/includes/admin.php b/includes/admin.php index 526d7f7..c168e49 100644 --- a/includes/admin.php +++ b/includes/admin.php @@ -27,3 +27,50 @@ function metiers_remove_meta_boxes() remove_post_type_support('chantiers', 'comments'); } add_action('admin_init', 'metiers_remove_meta_boxes'); + + + + +/* --------------------------- +CUSTOM POST STATUS +---------------------------*/ + +function metiers_patrimoine_custom_post_status() +{ + register_post_status('offline', array( + 'label' => _x('Offline', 'post'), + 'public' => true, + 'exclude_from_search' => false, + 'show_in_admin_all_list' => true, + 'show_in_admin_status_list' => true, + 'label_count' => _n_noop('Unread (%s)', 'Unread (%s)'), + )); +} +add_action('init', 'metiers_patrimoine_custom_post_status'); + + +function metiers_patrimoine_add_to_post_status_dropdown() +{ + global $post; + // if ($post->post_type != 'pdf_order') + // return false; + $status = ($post->post_statu == 'offline') ? "jQuery( '#post-status-display' ).text( 'Offline' ); jQuery( +'select[name=\"post_status\"]' ).val('completed');" : ''; + echo ""; +} +add_action('post_submitbox_misc_actions', 'metiers_patrimoine_add_to_post_status_dropdown'); + + + +add_action('edit_form_after_title', function () { + // Vérifie si on est sur le bon post type + $screen = get_current_screen(); + if ($screen && $screen->post_type === 'artisans') { // Remplacez 'votre_cpt' par le slug de votre CPT + echo '

' . get_the_title() . '

'; + } +});