Add the date to a specific wp_nav_menu

Adding this snippet to the functions.php of your wordpress theme will insert the date into your wordpress wp_nav_menu(). Don’t forget to change MENU_NAME to the name of the menu you wish to add the date.



add_filter('wp_nav_menu_items','add_date', 10, 2);
function add_date($items, $args) {
if( $args->theme_location == 'MENU_NAME' )
return $items . '<li class="navdate">' . date("l F jS, Y") . '</li>';
return $items;

Leave a comment