-
AuthorPosts
-
June 13, 2023 at 4:34 pm #1410474
Hi, after google page speed test, results showed me about a problem: miss [role] attribute in menu burger, with html <li class=”av-burger-menu-main menu-item-avia-special “>
how can i add it?
June 14, 2023 at 10:24 am #1410557Hey edolmen,
Thank you for the inquiry.
The screenshot above is not accessible. Would you mind providing another screenshot? You can use platforms like Savvyify, Imgur or Dropbox to upload and share the screenshot. Here are the steps to follow:
1.) Visit the website of your chosen platform, such as Savvyify, Imgur or Dropbox.
2.) Locate the option to upload a file or an image.
3.) Select the screenshot file from your computer or device and upload it to the platform.
4.) After the upload is complete, you will be provided with a shareable link or an embed code.
5.) Copy the link or code and include it in your message or response to provide us with the screenshot.If you want to modify the markup of the burger menu, try to add this code in the functions.php file.
if( ! function_exists( 'avia_append_burger_menu_mod' ) ) { //first append search item to main menu remove_filter( 'wp_nav_menu_items', 'avia_append_burger_menu', 9998, 2 ); remove_filter( 'avf_fallback_menu_items', 'avia_append_burger_menu', 9998, 2 ); add_filter( 'wp_nav_menu_items', 'avia_append_burger_menu_mod', 9998, 2 ); add_filter( 'avf_fallback_menu_items', 'avia_append_burger_menu_mod', 9998, 2 ); /** * Append the burger menu * * @param string $items * @param array $args * @return string */ function avia_append_burger_menu_mod ( $items , $args ) { global $avia_config; $location = ( is_object( $args ) && isset( $args->theme_location ) ) ? $args->theme_location : ''; $original_location = isset( $avia_config['current_menu_location_output'] ) ? $avia_config['current_menu_location_output'] : ''; /** * Allow compatibility with plugins that change menu or third party plugins to manpulate the location * * @used_by Enfold config-menu-exchange\config.php 10 * @since 4.1.3 */ $location = apply_filters( 'avf_append_burger_menu_location', $location, $original_location, $items , $args ); if( ( is_object( $args ) && ( $location == 'avia' ) ) || ( is_string( $args ) && ( $args == 'fallback_menu' ) ) ) { $class = avia_get_option('burger_size'); $items .= ' <li class="av-burger-menu-main menu-item-avia-special ' . $class . '"> <a href="#" aria-label="' . esc_attr( __( 'Menu', 'avia_framework' ) ) . '" aria-hidden="false"> <span class="av-hamburger av-hamburger--spin av-js-hamburger"> <span class="av-hamburger-box"> <span class="av-hamburger-inner"></span> <strong>' . __( 'Menu', 'avia_framework' ) . '</strong> </span> </span> <span class="avia_hidden_link_text">' . esc_html( __( 'Menu', 'avia_framework' ) ) . '</span> </a></li> '; } return $items; } }
You may need to add role attribute somewhere in this code.
$items .= ' <li class="av-burger-menu-main menu-item-avia-special ' . $class . '"> <a href="#" aria-label="' . esc_attr( __( 'Menu', 'avia_framework' ) ) . '" aria-hidden="false"> <span class="av-hamburger av-hamburger--spin av-js-hamburger"> <span class="av-hamburger-box"> <span class="av-hamburger-inner"></span> <strong>' . __( 'Menu', 'avia_framework' ) . '</strong> </span> </span> <span class="avia_hidden_link_text">' . esc_html( __( 'Menu', 'avia_framework' ) ) . '</span> </a></li> ';
Best regards,
IsmaelJune 14, 2023 at 10:33 am #1410560June 14, 2023 at 6:20 pm #1410623Hi,
Please try the modification that Ismael suggested, or perhaps try adding this code to the end of your child theme functions.php file in Appearance ▸ Editor:function custom_script_change_nav_role() { ?> <script> window.addEventListener('DOMContentLoaded', function() { (function ($) { $(".menu-item-avia-special").attr('role','menu' ); })(jQuery); }); </script> <?php } add_action('wp_footer', 'custom_script_change_nav_role');
Best regards,
MikeJune 21, 2023 at 4:22 pm #1411290ok it works thanks
June 21, 2023 at 8:05 pm #1411303Hi,
Glad we were able to help, if you have any further questions please create a new thread and we will gladly try to help you. Thank you for using Enfold.Best regards,
Mike -
AuthorPosts
- The topic ‘miss [role] in burger menu’ is closed to new replies.