Jetpack by WordPress.com
[resolved] Add date to related posts (3 posts)

  1. candreu
    Posted 1 year ago #

    Can I add the date of the post in the related posts? And can I limit the age of the related posts to show only the most recent?


  2. Richard Archambault
    Happiness Engineer
    Plugin Author

    Posted 1 year ago #

    Try this to limit the age:

    function jetpackme_related_posts_past_year_only( $date_range ) {
        $date_range = array(
            'from' => strtotime( '-2 months' ),
            'to' => time(),
        return $date_range;
    add_filter( 'jetpack_relatedposts_filter_date_range', 'jetpackme_related_posts_past_year_only' );

    Note that the actual filter for date ranges will only be accurate down to the month for caching purposes; this filter is not really designed for fine grained control! So if you say you only want posts from March 2012 onwards it may actually include some posts from late Feb 2012 as well in the results.

    Asof ro showing the date, no, there is no way that I know of for doing that. I have opened an enhancement request for that:


  3. candreu
    Posted 1 year ago #

    Thank you. I will try it.

Topic Closed

This topic has been closed to new replies.

About this Plugin

  • Jetpack by WordPress.com
  • Frequently Asked Questions
  • Support Threads
  • Reviews

About this Topic