1

I have a technology blog based on wordpress. I would like it to show a icon on top of the menu bar to show new post counter for today. Just like Android Authority website (check here http://prnt.sc/ck4q62) Am a newbie here and i dont know a lot about CSS and Function.php the only thing i know is basic wordpress editing skills. I've tried google about it, but without any luck at all.

Any ideas on how to do it or the function.php file i can add in my theme child theme am using bunchy wordpress theme)

Thanks in Advance You For Your Help

closed as too broad by Mark Kaplun, TheDeadMedic, fuxia Sep 20 '16 at 10:10

Please edit the question to limit it to a specific problem with enough detail to identify an adequate answer. Avoid asking multiple distinct questions at once. See the How to Ask page for help clarifying this question. If this question can be reworded to fit the rules in the help center, please edit the question.

0

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();
0

Have a look here Count posts or custom post types from last 24 hours (or from today)

The main goal would be to count all the published posts then loop through and get the ones that match the todays date.

Jason

  • Please include essential parts if you are linking elsewhere or just make such a comment instead of answer. Link-only answers are considered low quality, links die over time. – Rarst Sep 20 '16 at 15:55

Not the answer you're looking for? Browse other questions tagged or ask your own question.