is_amp() ) { return; } // Enqueue the navigation script. wp_enqueue_script( 'bongo-navigation', get_theme_file_uri( '/assets/js/navigation.min.js' ), array(), bongo()->get_asset_version( get_theme_file_path( '/assets/js/navigation.min.js' ) ), false ); wp_script_add_data( 'bongo-navigation', 'async', true ); wp_script_add_data( 'bongo-navigation', 'precache', true ); wp_localize_script( 'bongo-navigation', 'bongoScreenReaderText', array( 'expand' => __( 'Expand child menu', 'bongo' ), 'collapse' => __( 'Collapse child menu', 'bongo' ), ) ); } /** * Prints an inline script to fix skip link focus in IE11. * * The script is not enqueued because it is tiny and because it is only for IE11, * thus it does not warrant having an entire dedicated blocking script being loaded. * * Since it will never need to be changed, it is simply printed in its minified version. * * @link https://git.io/vWdr2 */ public function action_print_skip_link_focus_fix() { // If the AMP plugin is active, return early. if ( bongo()->is_amp() ) { return; } // Print the minified script. ?> ` element. * @param WP_Post $item The current menu item. * @return array Modified HTML attributes */ public function filter_nav_menu_link_attributes_aria_current( array $atts, WP_Post $item ) : array { if ( isset( $item->current ) ) { if ( $item->current ) { $atts['aria-current'] = 'page'; } } elseif ( ! empty( $item->ID ) ) { global $post; if ( ! empty( $post->ID ) && (int) $post->ID === (int) $item->ID ) { $atts['aria-current'] = 'page'; } } return $atts; } }