Home > Software design >  Where/how to edit mobile menu on custom-coded site
Where/how to edit mobile menu on custom-coded site

Time:09-17

I am looking to update a link in the mobile hamburger menu on a custom-coded website that uses custom fields. I want a menu item to link to a pdf instead of a #section (one-page site).

I have scoured the code and can't find where the actual links are to change them. FYI I am not a code-warrior - sorry in advance.

The main menu is managed through the menu section of the Wordpress site, while the mobile menu is not. When I update the main menu links, the mobile menu links do not change. I am guessing it has something to do with this snippet of code (because when I remove it, the menu disappears) but I can't find the source.

<a href="javascript:showMenu();" id="mobile-menu"><span></span></a>

Any thoughts on how I can edit the mobile menu links OR get the main menu to control the mobile menu?

Partial code from header.php:

    <header id="masthead"  role="banner">
    <div >
        <div >
            <ul >
                <?php if(get_option('mytheme_fb')): ?><li ><a href="<?php echo get_option('mytheme_fb'); ?>" target="_blank">Facebook</a><em></em></li><?php endif; ?>
                <?php if(get_option('mytheme_twt')): ?><li ><a href="<?php echo get_option('mytheme_twt'); ?>" target="_blank">Twitter</a><em></em></li><?php endif; ?>
                <?php if(get_option('mytheme_instagram')): ?><li ><a href="<?php echo get_option('mytheme_instagram'); ?>" target="_blank">instagram</a><em></em></li><?php endif; ?>
            </ul>
            <div >For groups of 10  please call <a href="tel:7807571114">780-757-1114</a></div>
            <div >
                <a href="<?php echo get_option('mytheme_reserv'); ?>"  target="_blank">MAKE A RESERVATION</a>
                <a href="http://sabordivinorestaurantlounge.fbmta.com/members/UpdateProfile.aspx?Action=Subscribe"  target="_blank">JOIN OUR MAILING LIST</a>
            </div>
        </div>
        <div ><a href="<?php echo esc_url( home_url( '/' ) ); ?>" rel="home"><?php bloginfo( 'name' ); ?></a></div>
        <a href="javascript:showMenu();" id="mobile-menu"><span></span></a>
        <nav id="site-navi"  role="navigation" aria-label="<?php esc_attr_e( 'Primary Menu', 'Sabor' ); ?>">
            <?php
                wp_nav_menu( array(
                    'theme_location' => 'primary',
                    'menu'     => 'Main menu',
                 ) );
            ?>
        </nav><!-- .main-navigation -->

CodePudding user response:

This "code" causes a fatal error: Call to undefined function wp_nav_menu()

            wp_nav_menu( array(
                'theme_location' => 'primary',
                'menu'     => 'Main menu',
             ) );

CodePudding user response:

ShowMenu() is a javascript function. Showing php and html code won't answer your question

  • Related