How to add a "new" button to most rcent posts? (3 posts)

  1. billdennis5
    Posted 8 years ago #

    I just switched to a magazine style them that lets me put the post important post of the day at the top, with other posts in chronological order below.


    I'd like a say to tip off readers which of the posts that follow are "new" perhaps with a tiny button saying "NEW!" or something similar.

    Are there are plugins that can do this, or snippits of code that can do this?

    Thanks for any advice

  2. Adam Brown
    Posted 8 years ago #

    By "new," do you mean new today, or new since the reader's last visit?

    If the former, it's easy. If the latter, you'll need to write yourself a little plugin (or edit your theme's functions.php) to send a cookie to the visitor's browser recording the time of their last visit.

    Whichever method you use, you would then edit your theme's loop to check whether the post is newer than the comparison point. If so, add an additional CSS class to the post (and CSS to your style.css), or spit out an image, or whatever is you want to change for new posts.

    That's the overview. Obviously, specifics are up to you.

  3. Adam Brown
    Posted 8 years ago #

    Bill, I got bored. Try this on for size:


Topic Closed

This topic has been closed to new replies.

About this Topic