PluginProbe
Responsive Menu – Create Mobile-Friendly Menu / 3.1.22
Responsive Menu – Create Mobile-Friendly Menu v3.1.22
4.7.3 3.1.5 3.1.6 3.1.7 3.1.8 3.1.9 4.0.0 4.0.1 4.0.2 4.0.3 4.0.4 4.1.0 4.1.1 4.1.10 4.1.11 4.1.12 4.1.2 4.1.3 4.1.4 4.1.5 4.1.6 4.1.7 4.1.8 4.1.9 4.2.0 All 90 releases
← All changes | config/twig.php +4 -15 4.1.23.1.22 View file →
@@ -4,8 +4,9 @@
4 4 dirname(dirname(__FILE__)) . '/views',
5 5 dirname(dirname(__FILE__)) . '/public',
6 6 ]), ['autoescape' => false, 'debug' => false]);
7 7
8 +//$twig->addExtension(new Twig_Extension_Debug());
8 9 if(!is_admin()):
9 10
10 11 $twig->addFilter(new Twig_SimpleFilter('shortcode', function($string) {
11 12 return do_shortcode($string);
@@ -22,17 +23,8 @@
22 23 $translator = $env->getFilter('translate')->getCallable();
23 24 $menu = $translator($options['menu_to_use'], 'menu_to_use');
24 25 $walker = $options['custom_walker'] ? new $options['custom_walker']($options) : new ResponsiveMenu\Walkers\Walker($options);
25 26
26 - /** Check menu is exist or not */
27 - $menu_arial_label = '';
28 - foreach( get_terms('nav_menu') as $nav_menu ) {
29 - if ( $nav_menu->slug === $menu ) {
30 - $menu_arial_label = $menu;
31 - break;
32 - }
33 - }
34 -
35 27 return wp_nav_menu(
36 28 [
37 29 'container' => '',
38 30 'menu_id' => 'responsive-menu',
@@ -40,9 +32,8 @@
40 32 'menu' => $menu && !$options['theme_location_menu'] ? $menu : null,
41 33 'depth' => $options['menu_depth'] ? $options['menu_depth'] : 0,
42 34 'theme_location' => $options['theme_location_menu'] ? $options['theme_location_menu'] : null,
43 35 'walker' => $walker,
44 - 'items_wrap' => '<ul id="%1$s" role="menubar" aria-label="'. $menu_arial_label .'" >%3$s</ul>',
45 36 'echo' => false
46 37 ]
47 38 );
48 39
@@ -67,16 +58,14 @@
67 58 }));
68 59
69 60 $twig->addFunction(new Twig_SimpleFunction('menu_items', function($options) {
70 61
71 - $menu = '';
72 - if( $options['theme_location_menu'] ) {
62 + if($options['theme_location_menu'])
73 63 $menu = get_term(get_nav_menu_locations()[$options['theme_location_menu']], 'nav_menu')->name;
74 - } elseif( $options['menu_to_use'] ) {
64 + elseif($options['menu_to_use'])
75 65 $menu = $options['menu_to_use'];
76 - } elseif( ! empty( get_terms('nav_menu')[0]->slug ) ) {
66 + else
77 67 $menu = get_terms('nav_menu')[0]->slug;
78 - }
79 68
80 69 return wp_get_nav_menu_items($menu);
81 70 }));
82 71