Needed this for a recent project as a client wanted to display the
wordpress calendar as a dropdown item within the menu. Add this snippet
to the functions.php of your wordpress theme will add a new menu item to
your wp_nav_menu that has a submenu calendar.
add_filter('wp_nav_menu_items','add_calendar', 10, 2);
function add_calendar($items, $args) {
if( $args->theme_location == 'header-navigation' )
return $items . '<li><a href="#">Calendar</a><ul class="sub-menu"><li>' . get_calendar(true,false) . '</li></ul></li>';
}
No comments:
Post a Comment