display number of posts by category Shortcode

OK, so the code is wrong, because there are a lot of errors in it:

  1. Shortcodes should return its results and they shouldn’t print anything.
  2. Shortcode callback takes an array of attributes as first param and not an ID.
  3. You don’t do anything with the parameter of your shortcode callback.
  4. You don’t pass any ID to get_the_category, so it will return array of categories for current post.
  5. You don’t check if there is any category assigned (get_the_category can return empty array).