I have an interesting problem that I could use some help resolving.
I have not done a ton of WordPress sites, but I am familiar with it, and very comfortable with PHP.
I need to know if there is a way to grab posts from the most recently created category in WordPress. Obviously, it's pretty easy and straightforward to grab articles from a specific category, and I don't need help there. What I need is to also filter for the most recently created category and only grab the sub-categories and posts that belong to it. I hope this makes sense.
My client has a magazine type thing going on. I am using the default category creation functionality of WP to allow them to create new "issues" each month. The category is actually the month and year. Think of a magazine, where for example the current issue(Category) is March 2015. They will create a new issue (Category) each month, and of course articles will be posted in sub categories of the current issue (Category).
How can I grab posts from the most recently created category for each month to display on the front end? This way in a table of contents it would look something like:
- March 2015 (Main, or "current" Category)
- Sub Category
- Article Title
- Article Title
- Article Title
- Sub Category
- Article Title
- Article Title
- Article Title
- Sub Category
...etc.
How can I query only the most recently created category and articles belonging to it?