FEAT handling return to button
This commit is contained in:
parent
51312bf17a
commit
33c6139a0e
|
|
@ -119,3 +119,25 @@ function metiers_patrimoine_orderby($query)
|
|||
}
|
||||
}
|
||||
add_action('pre_get_posts', 'metiers_patrimoine_orderby');
|
||||
|
||||
|
||||
|
||||
/* ---------------------------------------
|
||||
CUSTOM CONTENT AFTER POST TYPE TITLE
|
||||
------------------------------------------*/
|
||||
add_action('edit_form_after_title', function () {
|
||||
$screen = get_current_screen();
|
||||
|
||||
if ($screen && $screen->post_type === 'chantiers') {
|
||||
$linked_artisan_id = get_field('artisan');
|
||||
$return_to = isset($_GET['return_to']) ? $_GET['return_to'] : '';
|
||||
$edit_artisan_link = get_edit_post_link($linked_artisan_id);
|
||||
?>
|
||||
<?php if ($return_to) : ?>
|
||||
<a href="<?php echo esc_url($return_to) ?>" class="edit-fiche-artisan-link"><img src='<?php echo get_stylesheet_directory_uri() . '/resources/img/icons/tools.svg' ?>' /> Voir la fiche de l'artisan </a>
|
||||
<?php elseif ($linked_artisan_id) : ?>
|
||||
<a href="<?php echo esc_url($edit_artisan_link) ?>" class="edit-fiche-artisan-link"><img src='<?php echo get_stylesheet_directory_uri() . '/resources/img/icons/tools.svg' ?>' /> Voir la fiche de l'artisan </a>
|
||||
<?php endif; ?>
|
||||
<?php
|
||||
}
|
||||
});
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user