round up or down (2 posts)

  1. Paul Skip Brown
    Posted 2 years ago #

    Hi, don't think this is possible at the moment? I post weekly and have it set to revert to normal date format after 90 days. All seems to work well. What I'd really like to do though is keep the units rounded up or down. So for example '1 week ago' rather than '1 week and 3 days ago', '1 month ago' rather than 1 month and 12 days ago'. It just feels cleaner and for my purposes accurate enough (I only use it on archive pages rather than the post itself). If it were one or the other I would prefer to round down. Is this possible? Many thanks.


  2. Vegard Skjefstad
    Plugin Author

    Posted 2 years ago #

    This if not possible at the moment (without modifying the code). But I'm sure you're not the only who who'd find that feature useful, so I'll keep it in mind for the next release of the plugin.

    If you want to modify the code yourself, open the file wp_days_ago-core.php and replace line 82 with the following:

    if($t[2] >= 1 && !$foundYear && !$foundMonth) {

    Note that I haven't tested the code change, so I'm not 100% sure it'll work. But it should round everything down for you by skipping display of the number of days if it's more than a month since something was published.

Topic Closed

This topic has been closed to new replies.

About this Plugin

  • wp-days-ago
  • Frequently Asked Questions
  • Support Threads
  • Reviews

About this Topic