refactoring cleaning
All checks were successful
continuous-integration/drone/push Build is passing

This commit is contained in:
Antoine M 2025-02-18 16:04:57 +01:00
parent d39796f804
commit b9e8c4183a

View File

@ -158,18 +158,14 @@ add_filter('views_edit-artisans', function ($views) {
if (isset($views['publish'])) {
$views['publish'] = str_replace('Publié', 'En ligne', $views['publish']);
}
if (isset($views['offline'])) {
$views['offline'] = str_replace('Unread ', 'Hors ligne', $views['offline']);
}
return $views;
});
// Ajouter le statut personnalisé aux actions de groupe
/* ------------------------------------------------------------------------------------------
AJOUTER LE STATUT 'OFFLINE' DANS LE FILTRE RAPIDE (QUICK EDIT) de BULK ACTIION
--------------------------------------------------------------------------------------------*/
function add_custom_bulk_actions($actions)
{
$actions['mark_offline'] = __('Mettre hors ligne', 'metiers-patrimoine-theme');
@ -220,20 +216,9 @@ add_action('admin_notices', 'custom_bulk_admin_notices');
/* -----------------------------------------------------
POST STATUS AFTER TITLE ON EDIT PAGE WITH ALL POSTS
-----------------------------------------------------*/
/* -------------------------------------------------------------------
POST STATUS AFTER TITLE ON EDIT PAGE WITH ALL POSTS (POST STATES COLUMN)
-------------------------------------------------------------------*/
// Ajouter un statut personnalisé dans la colonne des statuts, uniquement dans la vue "Tous"
function add_custom_post_status($post_states, $post)
@ -303,71 +288,9 @@ add_action('admin_menu', function () {
});
function hide_meta_boxes_by_default()
{
// List of meta boxes to hide by default
$hidden_meta_boxes = array(
'post' => array(
'postexcerpt', // Excerpt
'trackbacksdiv', // Trackbacks
'postcustom', // Custom Fields
'commentstatusdiv', // Discussion
'commentsdiv', // Comments
'authordiv', // Author
'slugdiv' // Slug
),
'page' => array(
'postexcerpt', // Excerpt
'trackbacksdiv', // Trackbacks
'postcustom', // Custom Fields
'commentstatusdiv', // Discussion
'commentsdiv', // Comments
'authordiv', // Author
'slugdiv' // Slug
)
);
// Get the current user ID
$user_id = get_current_user_id();
// Get the hidden meta boxes for the current user
$hidden = get_user_meta($user_id, 'metaboxhidden_post', true);
// Merge the existing hidden meta boxes with the new ones
$hidden = array_unique(array_merge((array) $hidden, $hidden_meta_boxes['post']));
// Update the user meta with the new hidden meta boxes
update_user_meta($user_id, 'metaboxhidden_post', $hidden);
// Repeat for pages
$hidden = get_user_meta($user_id, 'metaboxhidden_page', true);
$hidden = array_unique(array_merge((array) $hidden, $hidden_meta_boxes['page']));
update_user_meta($user_id, 'metaboxhidden_page', $hidden);
}
// Hook the function to the admin_init action
// add_action('admin_init', 'hide_meta_boxes_by_default');
function hide_wpml_language_metabox()
{
// Supprime la meta box "Langue" de WPML dans l'éditeur de post
remove_meta_box('icl_div', 'post', 'side');
remove_meta_box('icl_div', 'page', 'side');
// Ajoutez d'autres types de post si nécessaire
}
// Applique la fonction pour masquer la meta box "Langue"
// add_action('admin_menu', 'hide_wpml_language_metabox');
/* ----------------------------------------------------------------------
BODY CLASS
------------------------------------------------------------------------*/
//** BODY CLASS FOR USER ROLE *//
function add_user_role_to_admin_body_class($classes)
{
@ -428,15 +351,3 @@ function add_custom_taxonomy_menu_item()
);
}
add_action('admin_menu', 'add_custom_taxonomy_menu_item');
// function add_custom_update_button()
// {
// global $post;
// if ($post->post_status === 'publish') {
// $update_url = admin_url('post.php?post=' . $post->ID . '&action=edit');
// echo '<a href="' . esc_url($update_url) . '" class="button button-secondary" style="margin-left:10px;">Mettre à jour l\'article</a>';
// }
// }
// add_action('post_submitbox_misc_actions', 'add_custom_update_button');