I have a blog that is documenting an airplane build process. Posts describe the work done each day, and are organized into a category for each component. Each post has a custom field for hours logged during the tasks completed.
I would like to show the total hours (across all categories) as well as the total hours for each category not just on each post but on the landing page as well. For example:
Wings: 5 hrs <-- custom field for hours
Wings total: 84 hrs <-- sum of custom fields for hours in the Wings category
Build total: 432 hrs <-- sum of all custom fields for hours
I am struggling with how to approach this cleanly. I can create a custom post type, however this does not solve the problem of showing these totals elsewhere. Also, I would prefer not to do a query on each post and perform the operation on each page load as there will eventually be hundreds of posts (although that is probably possible).