Display Notification Bar on Header on Certain Post Count

A simple way to achieve this would be to do something like the following;

<?php
    $user_id = get_current_user_id();
    $post_count = count_user_posts($user_id);

    if ($post_count >= 50 && $post_count < 100) {
         // Congratulations you have submitted 50 posts!
    } elseif ($post_count >= 100) {
        // etc etc...
    } else {
        // do something else, or nothing.
    }
?>

You can place this within your header.php file, or for that matter in any template file should you choose to display this information elsewhere as this can run from out-side of your post loop.

WordPress API resources:

  • get_current_user_id LINK
  • count_user_posts LINK