FEEDBACK Make page-icon clickable by moving it inside list-item link

This commit is contained in:
Antoine M 2025-09-24 16:25:41 +02:00
parent 44217cdb11
commit 179cfd2e98

View File

@ -9,12 +9,10 @@ function carhop_wrap_parent_menu_item_buttons($output, $item, $depth, $args)
if ($args->theme_location === "primary") {
$page_icon = get_field('page_icon', $item->object_id);
if (isset($page_icon)) {
$icon = '<img class="page_icon" src="' . $page_icon['url'] . '" alt=""/>';
$link = $output;
$output = $icon . $link;
// Insérer l'icône à l'intérieur du lien (seulement la première occurrence)
$output = preg_replace('/>/', '>' . $icon, $output, 1);
}
}