Create hierarchical view widget for WordPress posts

Spread the love

Recently i got a chance to create a custom widget to display WordPress posts in hierarchical way, first By Year, then by Months and at last by Date.

So the widget displays following output:

I used custom mysql queries to get the data in the order i want. I created a custom table named “months” to keep the month ids and the months names.

So, after getting the results its time to create an unordered list hierarchical structure.

A quick demo can be seen at here