Highlight recently changed posts? (3 posts)

  1. Adam
    Posted 3 years ago #

    Hi wonderful WP forum-ers,

    I'm trying to put together what I assume (and hope) is a very simple function, and I'm totally lost.

    I have a list of posts, organized by category, and I want to highlight (in a way that I can style by CSS later) recently changed ones. That is, posts whose last modification date was X-days ago. I've scoured for plugins, and can't find one that does the trick. I know WordPress keeps track of post revisions, so I hope this is entry-level stuff, and I'm just too PHP-challenged to sort it out.

    Please help! Thank you!

  2. Michael
    Part-Time Forum Moderator
    Posted 3 years ago #

    general idea:

    $days = 4;
    if( (date('U') - get_the_modified_date('U')) <= 86400*$days ) { /*some action or output*/ };


    where exactly to use the code, depends on your theme, and the structure of your 'list of posts, organized by category'.

  3. Adam
    Posted 3 years ago #

    Thanks! This gives me a huge head-start.

Topic Closed

This topic has been closed to new replies.

About this Topic