custom post status & Fiex title on artisans
This commit is contained in:
parent
dff2a50c35
commit
037ac6675f
|
|
@ -27,3 +27,50 @@ function metiers_remove_meta_boxes()
|
||||||
remove_post_type_support('chantiers', 'comments');
|
remove_post_type_support('chantiers', 'comments');
|
||||||
}
|
}
|
||||||
add_action('admin_init', 'metiers_remove_meta_boxes');
|
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 "<script>
|
||||||
|
jQuery(document).ready( function() {
|
||||||
|
jQuery( 'select[name=\"post_status\"]' ).append( '<option value=\"completed\">Completed</option>' );
|
||||||
|
" . $status . "
|
||||||
|
});
|
||||||
|
</script>";
|
||||||
|
}
|
||||||
|
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 '<h1 class="admin-artisan-title">' . get_the_title() . '</h1>';
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue
Block a user