Skip to content

Instantly share code, notes, and snippets.

@lindseyriel
Created March 25, 2019 15:04
Show Gist options
  • Save lindseyriel/c713cd128a7fe2e181360ec0bb84d060 to your computer and use it in GitHub Desktop.
Save lindseyriel/c713cd128a7fe2e181360ec0bb84d060 to your computer and use it in GitHub Desktop.
Add Date to Primary Navigation Bar
//* Add Date to Primary Navigation
add_filter( 'wp_nav_menu_items', 'theme_menu_extras', 10, 2 );
function theme_menu_extras( $menu, $args ) {
//* Change 'primary' to 'secondary' to add extras to the secondary navigation menu
if ( 'primary' !== $args->theme_location )
return $menu;
$menu .= '<li class="right date">' . date_i18n( get_option( 'date_format' ) ) . '</li>';
return $menu;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment