“All posts” in the category widget

If the default category widget’s interface doesn’t offer what you want, there are roughly two courses of action: find another widget or adapt the existing one. The first would be outside the scope of this site, the second one is a bit too broad, but here’s what you would do for big adaptations:

  1. Build the basic code for a plugin to insert your own widget in. If you know your php you can learn this in ten minutes.

  2. Retrieve the code for the default category widget and insert it in your plugin. Rename the class to prevent conflicts.

  3. Adapt the code to insert “All posts” as a list item before the call to wp_list_categories. If you’re using drowpdowns it’s more complicated, because you will need to delve into the wp_dropdown_categories function.

Note that both latter functions end with filters that let you change the output. If you are sure this won’t interfere with other calls to these functions, you could add a filter in the functions.php of your theme to do the modification. This might be pragmatic, but it is also risky. Untested example:

add_filter ('wp_list_categories', 'wpse250758_add_all_posts');
function wpse250758_add_all_posts ($output) {
  $count = wp_count_posts();
  preg_replace ('<ul>','<ul><li>All Posts ('. $count->publish .  ')</li>', $output,1);
  return $output;
  }