Support » Plugin: wp-days-ago » round up or down

  • 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.

    https://wordpress.org/plugins/wp-days-ago/

Viewing 1 replies (of 1 total)
  • Plugin Author Vegard Skjefstad

    (@vskjefst)

    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.

Viewing 1 replies (of 1 total)
  • The topic ‘round up or down’ is closed to new replies.