I am searching for a way to find out what is the current view of my blog pages.
For example, by using “if (is_archive()) ” I can know that the page is an archive page.
Similarly, I want to find the code to know the following:
1. Categories view.
2. Calendar view (months)
3. Calendar view (date)
The reason I want to do this is because I have made the sidebar into an accordion and based on what is the link that the user clicked from the accordion, I want to open and close the accordion items.
My accordion contains following:
1. Latest Posts
They are all closed in the begining.
Assuming the user opened the Calendar. The accordion expands to show the calendar. Then the user clicks one of the date in the calendar to view posts from that date.
Here what I want is some way to identify that that a “date” was clicked.
This would allow me to keep the Calendar view in the accordion open then the page reloads.
Same for the other things i listed above.
My question is, are there more such functions like “if (is_archive()) ” which I can use?
Thanks for your help.
- The topic ‘How to identify views.’ is closed to new replies.