In my theme i have a menu on the top of the page where i've links for my pages, this is the line of code in the header.php that generates topNav,

    <!-- BEGIN HEADER-TOP -->
    <?php wp_nav_menu(array('theme_location' => 'topNav', 'depth' => 3, 'fallback_cb' => false, 'menu_class' => 'topNav')); ?>
    <!-- END HEADER-TOP -->

And this is the output of the above line,

<div class="menu-top-container">
<ul id="menu-top" class="topNav">
<li id="menu-item-25" class="menu-item menu-item-type-post_type menu-item-object-page menu-item-25"><a href="http://localhost/wordpress/copyright-policy/">Copyright Policy</a></li>
<li id="menu-item-26" class="menu-item menu-item-type-post_type menu-item-object-page menu-item-26"><a href="http://localhost/wordpress/disclaimer/">Disclaimer</a></li>
<li id="menu-item-27" class="menu-item menu-item-type-post_type menu-item-object-page menu-item-27"><a href="http://localhost/wordpress/privacy-policy/">Privacy Policy</a></li>
<li id="menu-item-28" class="menu-item menu-item-type-post_type menu-item-object-page menu-item-28"><a href="http://localhost/wordpress/sample-page/">Sample Page</a></li>

What i want to do is to add date function on the right side of the menu, i don't know how to edit the above PHP code, i can do this manually by adding HTML code directly into the header.php but i have to do that every time just for adding a link. Please Guide me how can i add a div which holds the date function right after the <ul> tag ends.


  • Please be specific: What exactly do you want to achieve? What have you tried already? What didn't work? – fuxia Sep 27 '12 at 5:42
  • Updated my question – XeBii Sep 27 '12 at 6:46

wp_nav_menu has a $container parameter that can be used to set the type of container (div or nav) or to disable it.

You could set the parameter to false and hardcode the wrapper div whilst including a date inside of it:

<div class="navigation-wrap">
    <?php wp_nav_menu( array(
        'theme_location' => 'topNav',
        'depth' => 3,
        'fallback_cb' => false,
        'menu_class' => 'topNav',
        'container' => false
    )); ?>
    <div class="navigation-date">
        <?php echo date('l, jS \of F Y'); ?>

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.