Add External Link to OnePage Section Menu
-
Hello,
I’m using the excelent theme features to build my site.
I’m using the theme menu, that navigates over sections, and I’ve added an li on header.php menu builder to add a link to another page (so I won’t use only one page, the second page is a custom link to a product).<nav id="site-navigation" class="main-navigation" role="navigation" itemscope itemtype="https://schema.org/SiteNavigationElement"> <ul> <?php if( ! get_theme_mod( 'business_one_page_ed_home_link' ) ){ if( is_front_page() ){ ?> <li class = "<?php echo esc_attr( 'current-menu-item', 'business-one-page' ); ?>"><a href="<?php echo esc_url( home_url( '#home' ) ); ?>"><?php echo esc_html( $home_link_label ); ?></a></li> <?php }else{ ?> <li><a href="<?php echo esc_url( home_url( '/' ) ); ?>"><?php echo esc_html( $home_link_label ); ?></a></li> <?php } } foreach( $enabled_sections as $section ){ if( $section['menu_text'] ){ ?> <li><a href="<?php echo esc_url( home_url( '#' . esc_attr( $section['id'] ) ) ); ?>"><?php echo esc_html( $section['menu_text'] );?></a></li> <?php } } ?> --mycustomlink <li id ="shopitem"><a href="https://site/product/custport1/">shop</a></li> </ul> </nav>
Everything works ok, I can navigate between my second page and the main page, but I cannot highlight the menu item of second page when I’m in.
With wooks for wp_nav_menu I can’t reach beacuse the nav is not a standart one, so is there another way to get class .nav_menu_css_class assigned to my custom link like is done for sections?Thank you for your help
Hugo
Viewing 2 replies - 1 through 2 (of 2 total)
Viewing 2 replies - 1 through 2 (of 2 total)
- The topic ‘Add External Link to OnePage Section Menu’ is closed to new replies.