Unable to add extra elements to the main navi (wp_nav_menu_items)

Just out of luck, I tried adding the code to nav.php instead of the custom.php (which contains the functions.php in the Roots.io theme), and it worked like a charm.

Also, being based on Boostrap 3, I had to add some classes and attributes for the dropdown to work. Here’s the final code, if anybody else might need it:

function add_last_nav_item($items, $args) {
if (!is_admin() && $args->theme_location == 'primary_navigation') {
$items .= '<li><a class="dropdown-toggle" data-toggle="dropdown" data-target="#" href="#">Authors <b class="caret"></b></a><ul class="dropdown-menu"><li>' . wp_list_authors('show_fullname=1&optioncount=0&exclude_admin=0&orderby=post_count&order=DESC&number=8&echo=0') . '</li></ul></li>';
}
return $items;
}
add_filter( 'wp_nav_menu_items', 'add_last_nav_item', 10, 2 );