From 69df87f4ea8ea099b219874ae7e99c18b9b5e38a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jes=C3=BAs=20Amieiro=20Becerra?= <1667814+amieiro@users.noreply.github.com> Date: Mon, 19 Feb 2024 22:46:33 +0100 Subject: [PATCH] Remove the "Event link" in the top right menu (#108) * Remove the "Event link" in the top right menu * Update the header in the gp_event_nav_menu_items function --- wporg-gp-translation-events.php | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/wporg-gp-translation-events.php b/wporg-gp-translation-events.php index 0be43104..bf611a56 100644 --- a/wporg-gp-translation-events.php +++ b/wporg-gp-translation-events.php @@ -317,15 +317,19 @@ function register_translation_event_js() { /** * Add the events link to the GlotPress main menu. * - * @param array $items The menu items. + * @param array $items The menu items. + * @param string $location The menu location. * @return array The modified menu items. */ -function gp_event_nav_menu_items( array $items ): array { +function gp_event_nav_menu_items( array $items, string $location ): array { + if ( 'main' !== $location ) { + return $items; + } $new[ esc_url( gp_url( '/events/' ) ) ] = esc_html__( 'Events', 'gp-translation-events' ); return array_merge( $items, $new ); } // Add the events link to the GlotPress main menu. -add_filter( 'gp_nav_menu_items', 'Wporg\TranslationEvents\gp_event_nav_menu_items' ); +add_filter( 'gp_nav_menu_items', 'Wporg\TranslationEvents\gp_event_nav_menu_items', 10, 2 ); /** * Generate a slug for the event post type when we save a draft event.