• Resolved pict3000

    (@pict3000)


    The main mobile screen menu bar — i.e. before the main navigation is tapped on and therefore collapsed — I want to modify what the text says. The default text is “Navigation”. I want to change that to say “Tap For Menu”.

    The Storefront function for that is in header.php. I tried overriding that function in my child theme’s function.php, but the menu won’t collapse on click or tap. The text was changed as I wanted, but the menu won’t collapse (expand).

    What is the proper way to hook in and make these changes?

    Storefront’s function in header.php:

    function storefront_primary_navigation() {
    		?>
    		<nav id="site-navigation" class="main-navigation" role="navigation">
    		<button class="menu-toggle"><?php apply_filters( 'storefront_menu_toggle_text', $content = _e( 'Primary Menu', 'storefront' ) ); ?></button>
    			<?php wp_nav_menu( array( 'theme_location' => 'primary' ) ); ?>
    		</nav><!-- #site-navigation -->
    		<?php
    	}

    My overridden function in child theme’s function.php:

    function storefront_primary_navigation() {
    		?>
    	<nav id="site-navigation" class="main-navigation" role="navigation">
    		<button class="menu-toggle"><?php _e( 'Tap For Menu', 'storefront' ); ?></button>
    		<?php wp_nav_menu( array( 'theme_location' => 'primary' ) ); ?>
    	</nav><!-- #site-navigation -->
    	<?php
    }

    Please tell me how I can properly modify the menu bar.

Viewing 3 replies - 1 through 3 (of 3 total)
  • Thread Starter pict3000

    (@pict3000)

    BTW the link to my site is

    https://4ninths.com/

    To see which menu I’m referring to, resize/minimize your browser window until the main menu at the top of the page changes into a drop down menu.

    // change menu name on mobile menu
    add_filter( 'storefront_menu_toggle_text', 'jk_storefront_menu_toggle_text' );
    function jk_storefront_menu_toggle_text( $text ) {
    	$text = __( 'Tap For Menu' );
    	return $text;
    }

    That should do it

    Thread Starter pict3000

    (@pict3000)

    That did the job. You are a titan! Thanks.

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Modify small screen (mobile) main menu bar’ is closed to new replies.