FEAT handling return to button

This commit is contained in:
Antoine M 2025-04-07 12:17:46 +02:00
parent 1773c57871
commit 51312bf17a

View File

@ -96,8 +96,6 @@ add_action('edit_form_after_title', function () {
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');
$('#publish').trigger('click');
@ -161,6 +159,10 @@ function render_custom_chantier_box_content($post)
if ($chantiers->have_posts()) {
$artisan_id = get_the_ID();
$return_to = get_edit_post_link($artisan_id);
echo '<h3> Chantiers réalisé par l\'entreprise </h3>';
echo '<ul>';
while ($chantiers->have_posts()) {
@ -169,11 +171,11 @@ function render_custom_chantier_box_content($post)
echo '<li><a href="' . get_edit_post_link() . '"> <img src=' . get_stylesheet_directory_uri() . '/resources/img/icons/document-inspect.svg' . ' /> ' . $chantier_name . '</a></li>';
}
echo '</ul>';
echo '<a href="' . admin_url('post-new.php?post_type=chantiers') . '" class="new-chantier">Ajouter un chantier</a>';
echo '<a href="' . admin_url('post-new.php?post_type=chantiers&return_to=' . urlencode($return_to)) . '" class="new-chantier">Ajouter un chantier</a>';
} else {
echo '<h3> Chantiers réalisés</h3>';
echo '<p class="no-results">Aucun chantier pour cette entreprise</p>';
echo '<a href="' . admin_url('post-new.php?post_type=chantiers') . '" class="new-chantier">Ajouter un chantier</a>';
echo '<a href="' . admin_url('post-new.php?post_type=chantiers&return_to=' . urlencode($return_to)) . '" class="new-chantier">Ajouter un chantier</a>';
}
}