[Support request] Relative Dates

Please login to receive premium support.

Support for the free plugin can be found here.

Home Forums Pro Support Relative Dates

Viewing 2 posts - 1 through 2 (of 2 total)
  • Author
    Posts
  • #4236
    Rick
    Participant

    Tom, thanks for an excellent plugin. I’d like to make the dates relative, e.g., “1 hour ago”, “yesterday”, etc. I can easily do that site wide, but that’s not what I want. I want WPSP entries to have a relative date but leave everything else as they are set in WP general settings.

    Can you help with this?

    #4391
    Tom
    Keymaster

    Hi Rick,

    Sorry for not getting back to you sooner!

    You should be able to do this:

    add_filter( 'wpsp_date_output', 'tu_wpsp_relative_date' );
    function tu_wpsp_relative_date() {
        echo '<span class="wp-show-posts-posted-on wp-show-posts-meta">' . human_time_diff( get_the_time( 'U' ), current_time( 'timestamp' ) ) . ' ago</span>';
    }

    Let me know 🙂

Viewing 2 posts - 1 through 2 (of 2 total)
  • You must be logged in to reply to this topic.