I have a function to display the date of an article:
get_the_date('M j, Y');
This will return the date in a string:
Apr 10, 2015
I want to hide the year if it is the current year. What would be the best way to do this?
I have a function to display the date of an article:
get_the_date('M j, Y');
This will return the date in a string:
Apr 10, 2015
I want to hide the year if it is the current year. What would be the best way to do this?
As we don't know what's there in your get_the_date
function. This might help you.
if(date('Y')==get_the_date('Y')){
get_the_date('M j');
}
else{
get_the_date('M j, Y');
}