Take the 2-minute tour ×
WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

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,

<!-- BEGIN HEADER-TOP -->
<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>
</ul></div>
<!-- END HEADER-TOP -->

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.

Thanks

share|improve this question
    
Please be specific: What exactly do you want to achieve? What have you tried already? What didn't work? –  toscho Sep 27 '12 at 5:42
    
Updated my question –  XeBii Sep 27 '12 at 6:46
add comment

1 Answer 1

up vote 0 down vote accepted

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:

<!-- BEGIN HEADER-TOP -->
<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'); ?>
    </div>
</div>
<!-- END HEADER-TOP -->
share|improve this answer
    
Thanks for the reply Johannes, let me try your suggested method. –  XeBii Sep 27 '12 at 7:28
    
Dear Johannes Pille your answer solved my problem, now i can update menus from wp-admin area and have the date function as well. Thank you very much, i really appreciate your help :) –  XeBii Sep 27 '12 at 7:34
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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