How to Add Custom New Published Post Counter Icon on Top of the WordPress Site [closed]

Check out code below.
Function returns a number of posts published with todays date. You just have to modify a navigation a little bit to add this number counter to a menu bar.

echo "<h1>Today is: " . date("Y-m-d") . "</h1>";

function published_today() {
  $counter = 0;
  $posts = get_posts(array('numberposts'=>-1));
  foreach ($posts as $post){
    if (get_the_time('Y-m-d', $post->ID) === date("Y-m-d")) {
      $counter++;
    }
  }
  return "Posts published today: " . $counter;
}

echo published_today();

error code: 523