• Skip to primary navigation
  • Skip to main content
  • Skip to primary sidebar

WP SITES

2784

Original Genesis Tutorials & 6000+ Guaranteed Code

Snippets

  • Consultation
  • Full Access
  • Log in

Add Published Post Count After WP Nav Menu Items

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.

Register for full access

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.

Related Code

  • Replace Site Tagline With A Dynamic Published Posts Counter

Reader Interactions

Leave a Reply Cancel reply

You must be logged in to post a comment.

Primary Sidebar

Code written by Brad Dalton specialist for Genesis, WooCommerce & WordPress theme customization. Read More…

Advertise · WPEngine · Genesis · Log in

  • Access Problems
  • Account Details
  • Consulting
  • Tags