Jump to content
Sign in to follow this  
christycollins

Adding Date to Menu Bar

Recommended Posts

christycollins

I found where I can add this code and make the date show up in the menu bar. I can't figure out where it needs to go. I put it a couple of places and nothing happened. Can you please tell me? add_filter('wp_nav_menu_items','add_todaysdate_in_menu', 10, 2); function add_todaysdate_in_menu( $items, $args ) { if( $args->theme_location == 'primary') { $todaysdate = date('l jS F Y'); $items .= '' . $todaysdate . ''; } return $items; }

Share this post


Link to post
Share on other sites
Jenny

HI Christy. Rather than messing with PHP and hooks, you can try using a plugin. :) Check out http://wordpress.org/extend/plugins/dynamic-dates/ You can simply add the date shortcode (created by the plugin) to the "label" field of a new menu item (and just use # for the URL).


Jenny :: Web designer at Simple Mama (follow me at @simplemamacom)

Check out Share Me, a social sharing add-on for DMS that is super simple to set up.

Share this post


Link to post
Share on other sites
christycollins

Can you please tell me where this shortcode is? I activated the plugin but can't seem to find it.

Share this post


Link to post
Share on other sites
christycollins

[today] [this-month] [this-year] I put this in the navigation label and that's what shows up on the menu. Im sorry I have no codeing experience. :">

Share this post


Link to post
Share on other sites
catrina

I'm not sure if the shortcode would work in a navigation label. Is that where the plugin says you should put it?


Please read the docs before posting. Please do not private message me unless I ask you to.

Designer | Catrina Dulay

Founder | Catrina and Mouse

Share this post


Link to post
Share on other sites
christycollins

No, I thought you meant that it would work if I put # in the URL and the code in the NAV label. I want today's date to show up on the right side of the menu bar, not just in a post. Example: www.garancedore.fr

Share this post


Link to post
Share on other sites
christycollins

Yes it is active. Nothing shows up in the Settings panel.

Share this post


Link to post
Share on other sites
catrina

I don't think that would've made a difference anyway since shortcodes don't work in navigation labels for sure. You'll need an alternative way of adding the date and I'd recommend another plugin (which you can search for here: http://wordpress.org/extend/plugins/), but that may mean you'll need to add the date to the sidebar instead.


Please read the docs before posting. Please do not private message me unless I ask you to.

Designer | Catrina Dulay

Founder | Catrina and Mouse

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this  

×