• 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!

Viewing 2 replies - 1 through 2 (of 2 total)
  • 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.

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘php help’ is closed to new replies.