how can i set different menus on different pages in wordpress? -
i trying setup diffrent menu diffrent page like.
in home page need main menu link this
<a href='#home'>home</a> <a href='http://example.com/product'>product</a> <a href='#services'>services</a> <a href='#conact'>contact us</a>
in product page
<a href='http://example.com/#home'>home</a> <a href='http://example.com/product'>product</a> <a href='http://example.com/#services'>services</a> <a href='http://example.com/#conact'>contact us</a>
i using 1 page theme please me logic development. thanks
it impossible answer question without seeing more code, in abstract sense can achieved quite easily. yatendra pointed out, need register 2 menus in functions.php file:
function register_my_menus() { register_nav_menus( array( 'home-menu' => __( 'header menu' ), 'product-menu' => __( 'product menu' ) ) ); } add_action( 'init', 'register_my_menus' );
then, want embed similar header.php navigation should usding is_page_template()
, wp_nav_menu()
functions.
<?php if (is_page_template( 'products.php' )) // change name of file { // load product-menu wp_nav_menu( array( 'theme_location' => 'product-menu' ) ); } else { // load header-menu wp_nav_menu( array( 'theme_location' => 'header-menu' ) ); } ?>
however, one-page theme, parallax theme better not putting in conditional , wrapping them in <div>
tags , show , hiding them jquery. however, need see more code.
codex references:
Comments
Post a Comment