When I query the category (category.php), how to get the name of the current category, ie., the one that is being queried?
And for tag and date (be it the day, the month or the year)?
Thanks!!
|
When I query the category (category.php), how to get the name of the current category, ie., the one that is being queried? And for tag and date (be it the day, the month or the year)? Thanks!! |
|||
|
|
|
For category use For tag use For date use For example if you open twentyten theme you will see following: category.php:
date.php:
|
|||
|
|
|
In addition to the other answers, you can call: This works for custom taxonomies as well category and tag terms. Also, you might find it easier to use
|
||||
|
|
|
Try the following
See the Codex for more on formatting the date: HERE PS. These are to be called within the loop. Except the first two which must be outside the loop. |
||||
|
|
|
Thank you for your replies! I made this for date: for archive.php
then just
|
|||
|
|
|
This is probably more than you need right now, but is probably something you will need on other areas of your theme. This code gets the category name of the current post, then displays it as a link to the posts listed in the category via the category.php file.
|
|||
|
|