In archive.php, if it is a date archive, can I get the date using a function?
Consider a url like this: myfirstsite/2013/08 – I want to get the 2013/08
In archive.php, if it is a date archive, can I get the date using a function?
Consider a url like this: myfirstsite/2013/08 – I want to get the 2013/08
Comments are closed.
Use
get_query_var()
to get the date parts:In
wp_title()
a call toget_query_var('m')
is used for the month too, but I got always just a0
as value even on an URL like/2008/09/05/
.If you want to print the month name, use:
The month name will be translated by WordPress then.
There are also four conditional functions you can use: