wordpress snippets last updated   : April 22, 2014
we now have 631 snippets

Display top 8 authors in wp_nav_menu using wp_list_authors

wordpress snippet

Adding this snippet to the functions.php of your wordpress theme will add an authors item to your wp_nav_menu listing top eight authors by post count.

snippet :  PHPcopy
function wps_nav_authors($items, $args){
    if( $args->theme_location == 'header-navigation' )
        return $items . '<li><a href="#">Authors</a><ul class="sub-menu"><li>' . wp_list_authors('show_fullname=1&optioncount=0&orderby=post_count&order=DESC&number=8&echo=0') . '</li></ul></li>';
}
add_filter('wp_nav_menu_items','wps_nav_authors', 10, 2);

jqsnipp.com | we just launched jquery snippets website