• My target is to customize an existing theme by child theme, I am using TwentyEleven / 2011 theme, and started to modify it using child theme.

    Now my target is to : customize header navigation menu items. Now all coming from 2011 theme.

    Also the function of register_nav_menus() is not clear to me in theme functions file. I have read it in codex,

    My main queries is:
    1) how a menu is positioned in any location?
    2) say I have created a menu from dash board .. menu name : personal. Then added 3 menus e.g Google (pointing Google.com) , Yahoo (pointing Yahoo.com) and bing (pointing msn.com)

    In dashboard theme location shows dropdown Primary menu. I think this comes from functions.php file of \wordpress-3.4.2\wp-content\themes\twentyeleven\ folder and the following line is responsible for it.

    register_nav_menu( ‘primary’, __( ‘Primary Menu’, ‘twentyeleven’ ) );

    But my menu name is PERSONAL, I want to post it anywhere I want in WP Template of This child theme. I think in the above line theme location is primary, where shall I declare a theme location for a custom location?

    Menu addition is okay, but what is theme location where this menu will be shown ?

    Thanks
    Bikram

Viewing 7 replies - 1 through 7 (of 7 total)
  • Thread Starter Bikram

    (@webseos)

    I understand that header.php file shows a navigation menu in template, may be in this path
    \wordpress-3.4.2\wp-content\themes\twentyeleven\header.php

    <?php wp_nav_menu( array( ‘theme_location’ => ‘primary’ ) ); ?>
    ________________________________

    My query is my PERSONAL menu will be shown where ever I want, say middle of a div

    So my theme location is MIDDLE OF A DIV…

    May be I want to show it in my footer..

    So what are the steps to create a custom menu in child theme and show it where u want..

    You need to call the menu in whichever php file you want it — if in the footer, then in footer.php.

    So you’d make a copy of the footer.php file — and add the menu — and put that copy in your child theme folder. It will override the footer.php in the parent theme.

    Thread Starter Bikram

    (@webseos)

    Thanks for your replay. I understood what you said.

    Say I have 5 template files header.php, footer.php etc/

    So the steps is : (assuming child theme name ct2011

    In this folder’s functions.php file (of child theme) “\wordpress-3.4.2\wp-content\themes\child_theme_of_twentyeleven\” I have to write the following line and have to use an action hook:

    register_nav_menu( ‘personal_menu’, __( ‘Personal Menu’, ‘ct2011’ ) );

    Then in the template files , header.php, footer.php etc/ I have to write :
    <?php wp_nav_menu( array( ‘theme_location’ => ‘personal_menu’ ) ); ?>

    So after this I shall get – in the admin section of dashboard, “theme location” will show dropdown “Personal menu” and I can create any menu in dash board and assign it in “Personal menu”.

    Thread Starter Bikram

    (@webseos)

    So this tag personal_menu is MENU INDICATOR and this PHP code
    <?php wp_nav_menu( array( ‘theme_location’ => ‘personal_menu’ ) ); ?>
    will place the menu, a whole bunch of HTML code- dynamically will be placed, Whenever I shall use it… am I right ?

    Is this what you are following?

    https://codex.www.ads-software.com/Navigation_Menus

    Thread Starter Bikram

    (@webseos)

    Hi, WPyogi, yes I am following codex mentioned above. My target is to understand the steps of showing nav menu. I am following codex now. but I am open to any idea and not confined to anything specific.

    Thread Starter Bikram

    (@webseos)

    Is my steps are correct as I described above? I have another query :

    function register_my_menus() {
    register_nav_menus(
    array( ‘header-menu’ => __( ‘Header Menu’ ) )
    );
    }
    add_action( ‘init’, ‘register_my_menus’ );

    What this function does : __(‘Header Menu’)

Viewing 7 replies - 1 through 7 (of 7 total)
  • The topic ‘How to assign a customized theme location for a custom navigation menu’ is closed to new replies.