I have added a current date item successfully to my menu via functions.php (Wordpress 4.7) using:
add_filter('wp_nav_menu_items','add_todaysdate_in_menu', 10, 2);
function add_todaysdate_in_menu( $items, $args ) {
if( $args->theme_location == 'header-menu') {
$todaysdate = date('l jS F Y');
$items .= '<li class="menu-item">' . $todaysdate . '</li>';
}
return $items;
}
My problem is, that the styling is different to those item added in the wp-admin backend. I have tried a few things according to WP Menu Item CSS Classes, but still got problems with the classes. Help would be great. Thank you very much!