Skip to:
Content
Pages
Categories
Search
Top
Bottom

Different Time Stamp backgrounds depending on time ago posted…


  • Marcos Nobre
    Participant

    @onyx808

    Hey guys,

    I just thought of it be cool if I cool set a background color to the time stamp and have it change… for example if the update is less then one hour ago make the background green if the update is one hour or more make the background blue or something.. I know a simple “if else statement” should do but cant figure it out,… LOL

Viewing 2 replies - 1 through 2 (of 2 total)

  • Boone Gorges
    Keymaster

    @boonebgorges

    Here are some hints:
    – Get the current time with `time()`, convert the post time to UNIX format with ‘strtotime()’, and subtract the two. Remember that the difference will be in seconds. You can use that for comparison.
    – Apply CSS selectors conditionally to get what you want. So, assuming that you have set `$is_more_than_one_hour` hour to true or false based on the procedure just described, do something like
    `<li class=" more-than-one-hour” id=”activity-“>`
    in your activity/entry.php file (assuming that you’re talking about activity items)
    – Then just add the proper styles in your stylesheet.


    Marcos Nobre
    Participant

    @onyx808

    @boonebgorges shoots you lost me in the whole convert the post to UNIX format and subtract the two… =(

    is there a guide somewhere?

    Thank you!

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Different Time Stamp backgrounds depending on time ago posted…’ is closed to new replies.
Skip to toolbar