77 lines
2.4 KiB
PHP
77 lines
2.4 KiB
PHP
<?php
|
|
/* ---------------------------
|
|
ADMIN STYLES
|
|
---------------------------*/
|
|
|
|
// Amin Stylesheet
|
|
function metiers_du_patrimoine_custom_admin_stylesheet()
|
|
{
|
|
wp_enqueue_style('admin_styles', get_stylesheet_directory_uri() . '/css/admin-style.css');
|
|
}
|
|
|
|
add_action('admin_head', 'metiers_du_patrimoine_custom_admin_stylesheet');
|
|
|
|
/* ---------------------------
|
|
COMMENTS REMOVAL
|
|
---------------------------*/
|
|
|
|
function metiers_remove_meta_boxes()
|
|
{
|
|
# Removes meta from Posts #
|
|
// remove_meta_box('postexcerpt', 'post', 'normal');
|
|
// remove_meta_box('postcustom', 'post', 'normal');
|
|
// remove_meta_box('trackbacksdiv', 'post', 'normal');
|
|
remove_meta_box('commentstatusdiv', 'page', 'normal');
|
|
remove_meta_box('commentsdiv', 'page', 'normal');
|
|
remove_post_type_support('artisans', 'comments');
|
|
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 "<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>';
|
|
}
|
|
});
|