The problem
The TwentyTwelve theme has a responsive menu that reduces to a single Menu button when the window width is narrower than 600 pixels. Pressing the Menu button should reveal the menu, in a vertical list. With version 1.5, any clicking or pressing on the Menu button is ignored. The menu items do not get displayed. The problem is not restricted to mobile devices – you can recreate the problem with a window width less than 600 pixels.Fix
The fix requires a change to theheader.php
file in the child theme.
Replace
<h3 class="menu-toggle"><?php _e( 'Menu', 'twentytwelve' ); ?></h3>
<button class="menu-toggle"><?php _e( 'Menu', 'twentytwelve' ); ?></button>
Compatibility fix for oik child themes
Q. But what if you deliver a fix to your theme but TwentyTwelve is still at v1.4? A. The fix will cause the problem to occur until TwentyTwelve is upgraded. The solution for oik plugins’ child themes is to use a function that will test the current version of TwentyTwelve, and behave accordingly. Infunctions.php
we add the following function
You appear to be a bot. Output may be restricted
function oik20120_menu_toggle() { $installed_theme = wp_get_theme( "twentytwelve" ); if ( $installed_theme->exists() ) { $version = $installed_theme->get('Version'); if ( version_compare( $version, 1.5, 'ge' ) ) { ?> <button class="menu-toggle"><?php _e( 'Menu', 'twentytwelve' ); ?></button> <?php } else { ?> <h3 class="menu-toggle"><?php _e( 'Menu', 'twentytwelve' ); ?></h3> <?php } } } [/bw_api] and change <code>header.php</code> to use this function [bw_api] <?php oik20120_menu_toggle(); ?>
oik plugins fix
A version of the above fix will be developed, tested and delivered for the following themes:- oik2012
- oik20120 – Twenty Twelve child theme
- bespoke themes based on TwentyTwelve