Compare commits
No commits in common. "dab69b5ab927027627ff343b0c8beff1828afbf6" and "a88109953d3b3f19e48e36d615266ccfd15e77a6" have entirely different histories.
dab69b5ab9
...
a88109953d
|
|
@ -43,13 +43,13 @@ add_action('admin_init', 'metiers_remove_meta_boxes');
|
||||||
|
|
||||||
|
|
||||||
/* ---------------------------
|
/* ---------------------------
|
||||||
OFFLINE POST STATUS
|
CUSTOM POST STATUS
|
||||||
---------------------------*/
|
---------------------------*/
|
||||||
|
|
||||||
function custom_post_status()
|
function custom_post_status()
|
||||||
{
|
{
|
||||||
register_post_status('offline', array(
|
register_post_status('offline', array(
|
||||||
'label' => __('Hors ligne', 'metiers-patrimoine-theme'),
|
'label' => __('offline', 'metiers-patrimoine-theme'),
|
||||||
'public' => true,
|
'public' => true,
|
||||||
'exclude_from_search' => false,
|
'exclude_from_search' => false,
|
||||||
'show_in_admin_all_list' => true,
|
'show_in_admin_all_list' => true,
|
||||||
|
|
@ -79,55 +79,7 @@ jQuery(document).ready(function() {
|
||||||
});
|
});
|
||||||
</script>";
|
</script>";
|
||||||
}
|
}
|
||||||
// add_action('post_submitbox_misc_actions', 'add_to_post_status_dropdown');
|
add_action('post_submitbox_misc_actions', 'add_to_post_status_dropdown');
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
add_action('admin_footer-post.php', function () {
|
|
||||||
|
|
||||||
?><script>
|
|
||||||
jQuery(function($) {
|
|
||||||
$('#post_status').append('<option value="offline">Hors ligne</option>')
|
|
||||||
|
|
||||||
$('#post_status option[value="publish"]').text('En ligne');
|
|
||||||
$('#post_status option[value="pending"], #post_status option[value="draft"], #post_status option[value="private"]').remove();
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
<?php if ('offline' === get_post_status()) : ?>
|
|
||||||
$('#post-status-display').text('Hors ligne')
|
|
||||||
$('#post_status').val('offline')
|
|
||||||
|
|
||||||
<?php endif; ?>
|
|
||||||
})
|
|
||||||
</script>
|
|
||||||
<?php
|
|
||||||
|
|
||||||
});
|
|
||||||
|
|
||||||
add_action('admin_footer-edit.php', function () {
|
|
||||||
?>
|
|
||||||
<script>
|
|
||||||
jQuery(function($) {
|
|
||||||
$('#bulk-edit select[name="_status"]').append('<option value="offline">Hors ligne</option>');
|
|
||||||
$('#bulk-edit select[name="_status"] option[value="publish"]').text('En ligne');
|
|
||||||
$('#bulk-edit select[name="_status"] option[value="offline"]').text('Hors ligne');
|
|
||||||
$('#bulk-edit select[name="_status"] option[value="pending"], #bulk-edit select[name="_status"] option[value="draft"], #bulk-edit select[name="_status"] option[value="private"]').remove();
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
});
|
|
||||||
</script>
|
|
||||||
<?php
|
|
||||||
});
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
// Ajouter un filtre pour afficher les posts avec le statut 'offline'
|
// Ajouter un filtre pour afficher les posts avec le statut 'offline'
|
||||||
|
|
@ -161,71 +113,6 @@ add_filter('views_edit-artisans', function ($views) {
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
// Ajouter le statut personnalisé aux actions de groupe
|
|
||||||
function add_custom_bulk_actions($actions)
|
|
||||||
{
|
|
||||||
$actions['mark_offline'] = __('Mettre hors ligne', 'metiers-patrimoine-theme');
|
|
||||||
$actions['mark_online'] = __('Mettre en ligne', 'metiers-patrimoine-theme');
|
|
||||||
|
|
||||||
return $actions;
|
|
||||||
}
|
|
||||||
add_filter('bulk_actions-edit-artisans', 'add_custom_bulk_actions');
|
|
||||||
|
|
||||||
// Gérer l'action de groupe pour appliquer le statut 'offline'
|
|
||||||
function handle_custom_bulk_actions($redirect_to, $doaction, $post_ids)
|
|
||||||
{
|
|
||||||
if ($doaction === 'mark_offline') {
|
|
||||||
foreach ($post_ids as $post_id) {
|
|
||||||
wp_update_post(array(
|
|
||||||
'ID' => $post_id,
|
|
||||||
'post_status' => 'offline'
|
|
||||||
));
|
|
||||||
}
|
|
||||||
$redirect_to = add_query_arg('bulk_online_updated', count($post_ids), $redirect_to);
|
|
||||||
}
|
|
||||||
if ($doaction === 'mark_online') {
|
|
||||||
foreach ($post_ids as $post_id) {
|
|
||||||
wp_update_post(array(
|
|
||||||
'ID' => $post_id,
|
|
||||||
'post_status' => 'published'
|
|
||||||
));
|
|
||||||
}
|
|
||||||
$redirect_to = add_query_arg('bulk_offline_updated', count($post_ids), $redirect_to);
|
|
||||||
}
|
|
||||||
return $redirect_to;
|
|
||||||
}
|
|
||||||
add_filter('handle_bulk_actions-edit-artisans', 'handle_custom_bulk_actions', 10, 3);
|
|
||||||
|
|
||||||
// Ajouter un message d'administration pour confirmer l'action de groupe
|
|
||||||
function custom_bulk_admin_notices()
|
|
||||||
{
|
|
||||||
if (!empty($_REQUEST['bulk_online_updated'])) {
|
|
||||||
$message = sprintf(__('%d artisan(s) mis en ligne', 'metiers-patrimoine-theme'), intval($_REQUEST['bulk_online_updated']));
|
|
||||||
echo "<div class=\"updated\"><p>{$message}</p></div>";
|
|
||||||
}
|
|
||||||
if (!empty($_REQUEST['bulk_offline_updated'])) {
|
|
||||||
$message = sprintf(__('%d artisans mis hors ligne', 'metiers-patrimoine-theme'), intval($_REQUEST['bulk_offline_updated']));
|
|
||||||
echo "<div class=\"updated\"><p>{$message}</p></div>";
|
|
||||||
}
|
|
||||||
}
|
|
||||||
add_action('admin_notices', 'custom_bulk_admin_notices');
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/* -----------------------------------------------------
|
|
||||||
POST STATUS AFTER TITLE ON EDIT PAGE WITH ALL POSTS
|
|
||||||
-----------------------------------------------------*/
|
|
||||||
|
|
||||||
|
|
||||||
// Ajouter un statut personnalisé dans la colonne des statuts, uniquement dans la vue "Tous"
|
// Ajouter un statut personnalisé dans la colonne des statuts, uniquement dans la vue "Tous"
|
||||||
function add_custom_post_status($post_states, $post)
|
function add_custom_post_status($post_states, $post)
|
||||||
|
|
@ -239,12 +126,12 @@ function add_custom_post_status($post_states, $post)
|
||||||
|
|
||||||
// Ajouter le statut "Publié" si l'article est publié
|
// Ajouter le statut "Publié" si l'article est publié
|
||||||
if ('publish' === $post->post_status) {
|
if ('publish' === $post->post_status) {
|
||||||
$post_states[] = __('En ligne', 'metiers-patrimoine-theme'); // Affiche "Publié"
|
$post_states[] = __('Publié', 'metiers-patrimoine-theme'); // Affiche "Publié"
|
||||||
}
|
}
|
||||||
|
|
||||||
// Ajouter votre statut personnalisé (ex : "offline") si c'est le cas
|
// Ajouter votre statut personnalisé (ex : "offline") si c'est le cas
|
||||||
if ('offline' === get_post_status($post->ID)) {
|
if ('offline' === get_post_status($post->ID)) {
|
||||||
$post_states[] = __('Hors ligne', 'metiers-patrimoine-theme'); // Affiche "En attente"
|
$post_states[] = __('Offline', 'metiers-patrimoine-theme'); // Affiche "En attente"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -258,6 +145,10 @@ add_filter('display_post_states', 'add_custom_post_status', 10, 2);
|
||||||
/* ----------------------------------------------------------------------
|
/* ----------------------------------------------------------------------
|
||||||
REORDER ADMIN MENU & POST TYPE ORDER ON MENU BAR
|
REORDER ADMIN MENU & POST TYPE ORDER ON MENU BAR
|
||||||
------------------------------------------------------------------------*/
|
------------------------------------------------------------------------*/
|
||||||
|
/**
|
||||||
|
* Activates the 'menu_order' filter and then hooks into 'menu_order'
|
||||||
|
*/
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Filters WordPress' default menu order
|
* Filters WordPress' default menu order
|
||||||
*/
|
*/
|
||||||
|
|
@ -356,82 +247,57 @@ function hide_wpml_language_metabox()
|
||||||
// Applique la fonction pour masquer la meta box "Langue"
|
// Applique la fonction pour masquer la meta box "Langue"
|
||||||
// add_action('admin_menu', 'hide_wpml_language_metabox');
|
// add_action('admin_menu', 'hide_wpml_language_metabox');
|
||||||
|
|
||||||
|
|
||||||
/* ----------------------------------------------------------------------
|
|
||||||
BODY CLASS
|
|
||||||
------------------------------------------------------------------------*/
|
|
||||||
|
|
||||||
//** BODY CLASS FOR USER ROLE *//
|
|
||||||
function add_user_role_to_admin_body_class($classes)
|
function add_user_role_to_admin_body_class($classes)
|
||||||
{
|
{
|
||||||
$current_user = wp_get_current_user();
|
$current_user = wp_get_current_user();
|
||||||
if (!empty($current_user->roles)) {
|
if (!empty($current_user->roles)) {
|
||||||
foreach ($current_user->roles as $role) {
|
foreach ($current_user->roles as $role) {
|
||||||
$classes .= ' role-' . $role;
|
$classes .= ' role-' . $role;
|
||||||
|
$classes .= ' salut fred';
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
return $classes;
|
return $classes;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Applique le filtre pour ajouter la classe au corps de l'interface admin
|
||||||
add_filter('admin_body_class', 'add_user_role_to_admin_body_class');
|
add_filter('admin_body_class', 'add_user_role_to_admin_body_class');
|
||||||
|
|
||||||
|
|
||||||
//** BODY CLASS FOR POST STATUS *//
|
|
||||||
function add_post_status_to_body_class($classes)
|
|
||||||
{
|
|
||||||
global $post;
|
|
||||||
|
|
||||||
if ($post && isset($post->post_status)) {
|
|
||||||
$post_status = $post->post_status;
|
|
||||||
$classes .= ' post-status-' . $post_status;
|
|
||||||
// $classes[] = 'post-status-' . $post_status; // Ajoute une classe pour le statut du post
|
|
||||||
write_log($post_status);
|
|
||||||
}
|
|
||||||
|
|
||||||
return $classes;
|
|
||||||
}
|
|
||||||
add_filter('admin_body_class', 'add_post_status_to_body_class');
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/* ---------------------------------------------------------------------------------
|
|
||||||
RÉ-AJOUT DES ITEMS DE TAXONOMY DANS LE MENU, MAIS PAS SOUS ARTISANS MAIS À PART
|
|
||||||
-----------------------------------------------------------------------------------*/
|
|
||||||
|
|
||||||
function add_custom_taxonomy_menu_item()
|
function add_custom_taxonomy_menu_item()
|
||||||
{
|
{
|
||||||
add_menu_page(
|
add_menu_page(
|
||||||
'Métiers',
|
'Métiers', // Titre de la page dans le navigateur
|
||||||
'Métiers',
|
'Métiers', // Texte à afficher dans le menu
|
||||||
'edit_others_posts',
|
'edit_others_posts', // Capacité requise pour voir le menu
|
||||||
'edit-tags.php?taxonomy=metiers&post_type=artisans',
|
'edit-tags.php?taxonomy=metiers&post_type=artisans', // URL de la taxonomie
|
||||||
'',
|
'', // Pas de fonction de rappel, car nous redirigeons
|
||||||
'dashicons-tag',
|
'dashicons-tag', // Icône (facultatif)
|
||||||
50
|
50 // Position dans le menu (facultatif)
|
||||||
);
|
);
|
||||||
add_menu_page(
|
add_menu_page(
|
||||||
'Éléments du batiment',
|
'Éléments du batiment', // Titre de la page dans le navigateur
|
||||||
'Éléments du batiment',
|
'Éléments du batiment', // Texte à afficher dans le menu
|
||||||
'edit_others_posts',
|
'edit_others_posts', // Capacité requise pour voir le menu
|
||||||
'edit-tags.php?taxonomy=elementsbatiments&post_type=artisans',
|
'edit-tags.php?taxonomy=elementsbatiments&post_type=artisans', // URL de la taxonomie
|
||||||
'',
|
'', // Pas de fonction de rappel, car nous redirigeons
|
||||||
'dashicons-tag',
|
'dashicons-tag', // Icône (facultatif)
|
||||||
58
|
58 // Position dans le menu (facultatif)
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Ajoute l'élément de menu lors de l'initialisation de l'admin
|
||||||
add_action('admin_menu', 'add_custom_taxonomy_menu_item');
|
add_action('admin_menu', 'add_custom_taxonomy_menu_item');
|
||||||
|
|
||||||
|
|
||||||
// function add_custom_update_button()
|
function add_custom_update_button()
|
||||||
// {
|
{
|
||||||
// global $post;
|
global $post;
|
||||||
|
|
||||||
// if ($post->post_status === 'publish') {
|
if ($post->post_status === 'publish') {
|
||||||
// $update_url = admin_url('post.php?post=' . $post->ID . '&action=edit');
|
$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>';
|
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');
|
add_action('post_submitbox_misc_actions', 'add_custom_update_button');
|
||||||
|
|
|
||||||
|
|
@ -26,6 +26,33 @@ function metiers_patrimoine_artisans_post_updater($post_id)
|
||||||
add_action('acf/save_post', 'metiers_patrimoine_artisans_post_updater', 20);
|
add_action('acf/save_post', 'metiers_patrimoine_artisans_post_updater', 20);
|
||||||
|
|
||||||
|
|
||||||
|
function metiers_patrimoine_chantiers_post_updater($post_id)
|
||||||
|
{
|
||||||
|
if (!$post_id || get_post_type() !== 'chantiers') return;
|
||||||
|
|
||||||
|
$my_post = array();
|
||||||
|
$my_post['ID'] = $post_id;
|
||||||
|
|
||||||
|
$artisan = get_field("artisan", $post_id) ?? "";
|
||||||
|
$chantier_name = get_field("chantier_name", $post_id) ?? "";
|
||||||
|
$date = get_field("date", $post_id) ?? "";
|
||||||
|
$localisation = get_field("localisation", $post_id) ?? "";
|
||||||
|
|
||||||
|
if (!$artisan || !$chantier_name) return;
|
||||||
|
|
||||||
|
$title = $artisan->post_title . " | " . $chantier_name;
|
||||||
|
|
||||||
|
if ($localisation && isset($localisation['city'])) {
|
||||||
|
$title .= " | " . $localisation['city'];
|
||||||
|
}
|
||||||
|
if ($date) {
|
||||||
|
$title .= " | " . $date;
|
||||||
|
}
|
||||||
|
$my_post['post_title'] = $title;
|
||||||
|
wp_update_post($my_post);
|
||||||
|
}
|
||||||
|
add_action('acf/save_post', 'metiers_patrimoine_chantiers_post_updater', 20);
|
||||||
|
|
||||||
/* ---------------------------------------
|
/* ---------------------------------------
|
||||||
CUSTOM CONTENT AFTER POST TYPE TITLE
|
CUSTOM CONTENT AFTER POST TYPE TITLE
|
||||||
------------------------------------------*/
|
------------------------------------------*/
|
||||||
|
|
@ -50,25 +77,9 @@ add_action('edit_form_after_title', function () {
|
||||||
<p>Statut :</p>
|
<p>Statut :</p>
|
||||||
<span class="status-state status-state--<?php echo $status_mdp['value']; ?> "><?php echo $status_mdp['label']; ?></span>
|
<span class="status-state status-state--<?php echo $status_mdp['value']; ?> "><?php echo $status_mdp['label']; ?></span>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<button id="set-offline-status" class="button button-secondary">Mettre Hors Ligne</button>
|
|
||||||
<button id="set-online-status" class="button button-secondary">Mettre En Ligne</button>
|
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
<script>
|
|
||||||
jQuery(function($) {
|
|
||||||
$('#set-offline-status').on('click', function(e) {
|
|
||||||
e.preventDefault();
|
|
||||||
|
|
||||||
// Mettre à jour le champ caché du statut du post
|
|
||||||
$('#post_status').val('offline');
|
|
||||||
$('#post-status-display').text('Hors ligne');
|
|
||||||
|
|
||||||
// Sauvegarder immédiatement sans recharger
|
|
||||||
$('#publish').trigger('click');
|
|
||||||
});
|
|
||||||
});
|
|
||||||
</script>
|
|
||||||
<?php
|
<?php
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
@ -83,9 +94,9 @@ add_action('add_meta_boxes', function () {
|
||||||
'admin_artisan_chantier_list',
|
'admin_artisan_chantier_list',
|
||||||
'Chantiers réalisé par l\'entreprise',
|
'Chantiers réalisé par l\'entreprise',
|
||||||
'render_custom_chantier_box_content',
|
'render_custom_chantier_box_content',
|
||||||
'artisans',
|
'artisans', // Post type
|
||||||
'normal',
|
'normal', // Contexte
|
||||||
'default'
|
'default' // Priorité
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
@ -129,6 +140,7 @@ function render_custom_chantier_box_content($post)
|
||||||
}
|
}
|
||||||
|
|
||||||
/** REMOVE SUBMITDIV METABOX **/
|
/** REMOVE SUBMITDIV METABOX **/
|
||||||
|
|
||||||
add_action('admin_menu', 'remove_submit_div');
|
add_action('admin_menu', 'remove_submit_div');
|
||||||
function remove_submit_div()
|
function remove_submit_div()
|
||||||
{
|
{
|
||||||
|
|
@ -197,18 +209,75 @@ function prevent_meta_box_order($action)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/* ---------------------------------------
|
/* ---------------------------------------
|
||||||
DELETE USER PREFERENCES
|
DELETE USER PREFERENCES
|
||||||
------------------------------------------*/
|
------------------------------------------*/
|
||||||
function reset_user_metabox_order()
|
// function reset_user_metabox_order()
|
||||||
|
// {
|
||||||
|
// write_log('#############reset_user_metabox_order');
|
||||||
|
// $user_id = get_current_user_id();
|
||||||
|
// if ($user_id) {
|
||||||
|
// delete_user_meta($user_id, 'meta-box-order_artisans');
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
// add_action('load-post.php', 'reset_user_metabox_order');
|
||||||
|
// add_action('load-post-new.php', 'reset_user_metabox_order');
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
function my_custom_admin_button()
|
||||||
{
|
{
|
||||||
$user_id = get_current_user_id();
|
?>
|
||||||
if ($user_id && !current_user_can('administrator')) {
|
<form method="post" action="">
|
||||||
delete_user_meta($user_id, 'meta-box-order_artisans');
|
<?php wp_nonce_field('my_custom_action', 'my_custom_nonce'); ?>
|
||||||
|
<input type="submit" name="my_custom_button" class="button button-primary" value="Exécuter l'action">
|
||||||
|
</form>
|
||||||
|
<?php
|
||||||
|
}
|
||||||
|
|
||||||
|
function my_custom_options_page()
|
||||||
|
{
|
||||||
|
add_menu_page(
|
||||||
|
'Options personnaliséessssssss',
|
||||||
|
'Mes Optionsssssssssssssss',
|
||||||
|
'manage_options',
|
||||||
|
'my-custom-options',
|
||||||
|
'my_custom_options_callback'
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
function my_custom_options_callback()
|
||||||
|
{
|
||||||
|
?>
|
||||||
|
<div class="wrap">
|
||||||
|
<h1>Page d’options personnalisée</h1>
|
||||||
|
<?php my_custom_admin_button(); ?>
|
||||||
|
</div>
|
||||||
|
<?php
|
||||||
|
}
|
||||||
|
|
||||||
|
add_action('admin_menu', 'my_custom_options_page');
|
||||||
|
|
||||||
|
function my_custom_handle_button_action()
|
||||||
|
{
|
||||||
|
if (isset($_POST['my_custom_button']) && check_admin_referer('my_custom_action', 'my_custom_nonce')) {
|
||||||
|
error_log('#############yalaa');
|
||||||
|
// Mettre ici l’action à exécuter
|
||||||
|
// update_option('my_custom_message', 'L\'action a été exécutée avec succès !');
|
||||||
|
|
||||||
|
|
||||||
|
// Rediriger pour éviter la soumission multiple
|
||||||
|
// wp_redirect(admin_url('admin.php?page=my-custom-options&action=success'));
|
||||||
|
exit;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
add_action('load-post.php', 'reset_user_metabox_order');
|
add_action('admin_init', 'my_custom_handle_button_action');
|
||||||
add_action('load-post-new.php', 'reset_user_metabox_order');
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/* -------------------------------------------------
|
/* -------------------------------------------------
|
||||||
|
|
@ -238,6 +307,7 @@ function add_last_modified_date_to_publish_box()
|
||||||
// post_submit_meta_box($post, array('side' => 'core'));
|
// post_submit_meta_box($post, array('side' => 'core'));
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/* ----------------------------------------------------------------------
|
/* ----------------------------------------------------------------------
|
||||||
SUPPRIMER LA COLONNE RANK MATH SEO SI ELLE EST PRÉSENTE
|
SUPPRIMER LA COLONNE RANK MATH SEO SI ELLE EST PRÉSENTE
|
||||||
------------------------------------------------------------------------*/
|
------------------------------------------------------------------------*/
|
||||||
|
|
|
||||||
|
|
@ -1,33 +1,5 @@
|
||||||
<?php
|
<?php
|
||||||
|
|
||||||
function metiers_patrimoine_chantiers_post_updater($post_id)
|
|
||||||
{
|
|
||||||
if (!$post_id || get_post_type() !== 'chantiers') return;
|
|
||||||
|
|
||||||
$my_post = array();
|
|
||||||
$my_post['ID'] = $post_id;
|
|
||||||
|
|
||||||
$artisan = get_field("artisan", $post_id) ?? "";
|
|
||||||
$chantier_name = get_field("chantier_name", $post_id) ?? "";
|
|
||||||
$date = get_field("date", $post_id) ?? "";
|
|
||||||
$localisation = get_field("localisation", $post_id) ?? "";
|
|
||||||
|
|
||||||
if (!$artisan || !$chantier_name) return;
|
|
||||||
|
|
||||||
$title = $artisan->post_title . " | " . $chantier_name;
|
|
||||||
|
|
||||||
if ($localisation && isset($localisation['city'])) {
|
|
||||||
$title .= " | " . $localisation['city'];
|
|
||||||
}
|
|
||||||
if ($date) {
|
|
||||||
$title .= " | " . $date;
|
|
||||||
}
|
|
||||||
$my_post['post_title'] = $title;
|
|
||||||
wp_update_post($my_post);
|
|
||||||
}
|
|
||||||
add_action('acf/save_post', 'metiers_patrimoine_chantiers_post_updater', 20);
|
|
||||||
|
|
||||||
|
|
||||||
/* -----------------------------------------
|
/* -----------------------------------------
|
||||||
EDIT ARTISAN LINK ON CHANTIER EDIT PAGE
|
EDIT ARTISAN LINK ON CHANTIER EDIT PAGE
|
||||||
-----------------------------------------*/
|
-----------------------------------------*/
|
||||||
|
|
|
||||||
|
|
@ -55,10 +55,6 @@ body.post-type-artisans {
|
||||||
@apply text-center;
|
@apply text-center;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
.column-status .status-state {
|
|
||||||
@apply !border-none;
|
|
||||||
}
|
|
||||||
@media screen and (max-width: 1600px) {
|
@media screen and (max-width: 1600px) {
|
||||||
#lastmodified,
|
#lastmodified,
|
||||||
#onlinedate,
|
#onlinedate,
|
||||||
|
|
@ -92,7 +88,7 @@ body.post-type-artisans {
|
||||||
}
|
}
|
||||||
.iedit.type-artisans.status-offline.hentry {
|
.iedit.type-artisans.status-offline.hentry {
|
||||||
.column-title .post-state {
|
.column-title .post-state {
|
||||||
@apply text-neutral-500 border-neutral-500;
|
@apply text-neutral-700 border-neutral-700;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
.iedit.type-artisans.status-publish.hentry {
|
.iedit.type-artisans.status-publish.hentry {
|
||||||
|
|
@ -485,24 +481,20 @@ ul.striped > :nth-child(odd) {
|
||||||
&--publish {
|
&--publish {
|
||||||
@apply text-green-700 border-green-700;
|
@apply text-green-700 border-green-700;
|
||||||
}
|
}
|
||||||
&--ok:before,
|
|
||||||
&--publish:before {
|
&--publish:before {
|
||||||
@apply bg-green-700;
|
@apply bg-green-700;
|
||||||
}
|
}
|
||||||
|
|
||||||
&--draft,
|
|
||||||
&--offline {
|
&--offline {
|
||||||
@apply text-neutral-500 border-neutral-500;
|
@apply text-neutral-500 border-neutral-500;
|
||||||
}
|
}
|
||||||
&--draft:before,
|
|
||||||
&--offline:before {
|
&--offline:before {
|
||||||
@apply bg-neutral-500;
|
@apply bg-neutral-500;
|
||||||
}
|
}
|
||||||
&--pending,
|
|
||||||
&--to_contact {
|
&--to_contact {
|
||||||
@apply text-amber-700 border-amber-700;
|
@apply text-amber-700 border-amber-700;
|
||||||
}
|
}
|
||||||
&--pending:before,
|
|
||||||
&--to_contact:before {
|
&--to_contact:before {
|
||||||
@apply bg-amber-700;
|
@apply bg-amber-700;
|
||||||
}
|
}
|
||||||
|
|
@ -565,11 +557,6 @@ ul.striped > :nth-child(odd) {
|
||||||
@apply !mr-12 2xl:!mr-32 !max-w-screen-2xl;
|
@apply !mr-12 2xl:!mr-32 !max-w-screen-2xl;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
.subsubsub .mine,
|
|
||||||
.subsubsub .pillar_content {
|
|
||||||
@apply hidden;
|
|
||||||
}
|
|
||||||
#submitdiv #publish {
|
#submitdiv #publish {
|
||||||
@apply bg-rose-600;
|
@apply bg-rose-600;
|
||||||
.postbox-header {
|
.postbox-header {
|
||||||
|
|
@ -591,29 +578,3 @@ ul.striped > :nth-child(odd) {
|
||||||
@apply px-12;
|
@apply px-12;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#set-offline-status,
|
|
||||||
#set-online-status {
|
|
||||||
@apply text-white border-none rounded-xl px-4 !py-1 ml-auto;
|
|
||||||
}
|
|
||||||
|
|
||||||
#set-offline-status {
|
|
||||||
@apply bg-neutral-600;
|
|
||||||
&:hover {
|
|
||||||
@apply bg-neutral-800;
|
|
||||||
}
|
|
||||||
.post-status-offline & {
|
|
||||||
@apply hidden;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
#set-online-status {
|
|
||||||
@apply bg-green-700;
|
|
||||||
&:hover {
|
|
||||||
@apply bg-green-800;
|
|
||||||
}
|
|
||||||
|
|
||||||
.post-status-publish & {
|
|
||||||
@apply hidden;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue
Block a user