I want to create a conditional statement in a Wordpress theme and I don't know how to do it, syntax and all. This is actually the conditions I want:
if (today's date > 10 + date of post)
{...}
else
{...}
Thanks!
I want to create a conditional statement in a Wordpress theme and I don't know how to do it, syntax and all. This is actually the conditions I want:
if (today's date > 10 + date of post)
{...}
else
{...}
Thanks!
You could try the following:
<?php echo date("d"); ?>
That would echo the day of the month. As taken from the PHP manuel "Day of the month, 2 digits with leading zeros" 01 - 31. Then the if statment could be something like:
<?php
$date = date("d");
if($date > 10 + *dateofpostcode*) {
echo "True";
} else {
echo "False";
}
?>
I think that would work, but you would have to replace the *dateofpostcode* with the code that fetches the date of post from the database.
Hope I have helped you.
Thanks,
Matt
thanks matt! i'll try it.
This topic has been closed to new replies.