This code, once added to your child themes functions file, displays the post count in your nav menu.
Every time you publish a new post, it dynamically updates and also changes if you delete a published post.
You can change the primary in the code to secondary or any other nav menu location.
You can also change the text to anything you like and modify the functions parameters.
You need to pay to fully access this tutorial.
Enjoy unlimited access & coding support by registering.
You could also replace the last-child structural pseudo-class with last-of-type.
The only issue you may have is with the CSS class your theme uses.
Based on testing the code in different themes, i found the best way to work out which class to use is to inspect the output and try the different classes your theme generates.