Here’s a rough outline / concept how I would approach the challenge. Others might come up with different solutions, but I think something like this should get the job done.
- Create a custom post type, e.g.
reading_challenge
, to store the data. Addauthor
support to the post type so that the posts can be linked with your users. The cpt doesn’t need to be public. - Create a form (shortcode, maybe?) with a number input field for each day. Add current user ID as a hidden field. If an cpt exists for the user already, add the post’s ID in a hidden field, too. Also, prepopulate the fields with daily count data, if it exists in the custom post’s meta. Or you could have a form with just one input field and render it only, if the user has not yet submitted the data for that particular day.
- On form submit either create a new cpt post for the author and save the submitted data as
post_meta
or update existing post meta. - Query and use custom post(s) and meta data as needed. Regarding home page usage, you might want to “cache” the count data to a
transient
instead of doing the query and counting on every home page load.