Welcome to the Question2Answer Q&A. There's also a demo if you just want to try it out.
+3 votes
170 views
in Plugins by
I want to see how many questions are asked in a day as a counter. I want to add such counter to the homepage. It will reset itself every 24 hours. can someone do it?

1 Answer

+1 vote
by

It shouldn't be too hard to implement this either in your theme or as a layer plugin. Run a database query that returns the number of questions posted on the current day (or within the last 24 hours, whichever you prefer), and display that number wherever you like.

The query would look somewhat like this for the number of questions today:

SELECT count(*)
FROM qa_posts
WHERE type = 'Q' AND date(created) = curdate();

or like this for the number of questions in the past 24 hours:

SELECT count(*)
FROM qa_posts
WHERE type = 'Q' AND timestampdiff(hour, created, curdate()) <= 24;

...