• Resolved roxer82

    (@roxer82)


    Hello.
    I need to know the difference in days between current day and post date, not to display it but to take an action when it is older than 7 days.
    Example:
    If (current_time(‘mysql’) – get_the_time( ‘Y-m-d’ ) > 7days){echo “This post is old”;}
    I can’t find how to make it.

    Thanks in advance.

Viewing 1 replies (of 1 total)
  • Thread Starter roxer82

    (@roxer82)

    Ok,solved using timestamp.

    $Diff=(current_time('timestamp') - get_the_time('U'))/86400; //Diff in days.
    If($Diff >= 7){echo "This post is old";}

Viewing 1 replies (of 1 total)
  • The topic ‘Difference in days to take actions’ is closed to new replies.