Title: Post date under post title
Last modified: August 22, 2016

---

# Post date under post title

 *  Resolved [ananzeh25](https://wordpress.org/support/users/ananzeh25/)
 * (@ananzeh25)
 * [11 years, 10 months ago](https://wordpress.org/support/topic/post-date-under-post-title/)
 * Hi,
 * I want to thank you for you great plugin. It is the best out there so far.
    I
   was wondering of the way to add the date of the post under the post title. I 
   want my related posts to have the date beneath them.
 * Thank you
 * [https://wordpress.org/plugins/related-posts-by-taxonomy/](https://wordpress.org/plugins/related-posts-by-taxonomy/)

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

 *  Plugin Author [keesiemeijer](https://wordpress.org/support/users/keesiemeijer/)
 * (@keesiemeijer)
 * [11 years, 9 months ago](https://wordpress.org/support/topic/post-date-under-post-title/#post-5337417)
 * Hi ananzeh25
 * You can override the template files used by this plugin.
    [http://keesiemeijer.wordpress.com/related-posts-by-taxonomy/templates/](http://keesiemeijer.wordpress.com/related-posts-by-taxonomy/templates/)
 * Use the WordPress function get_the_date() in a template of your own.
    [http://codex.wordpress.org/Template_Tags/get_the_date](http://codex.wordpress.org/Template_Tags/get_the_date)
 * Here is an example for the links template (related-posts-links.php) with the 
   date after the post title: [http://pastebin.com/0hRR1GZn](http://pastebin.com/0hRR1GZn)
 * Follow the instructions for [the first method](http://keesiemeijer.wordpress.com/related-posts-by-taxonomy/templates/#copying)
   in the link above to have it use this template.
 *  Thread Starter [ananzeh25](https://wordpress.org/support/users/ananzeh25/)
 * (@ananzeh25)
 * [11 years, 9 months ago](https://wordpress.org/support/topic/post-date-under-post-title/#post-5337530)
 * Hi,
 * Thank you for you reply. What I did that I added
    <span class=”related-post-date”
   ><?php echo get_the_date(); ?></span> to all of the four templates so I can see
   quick result but nothing happened.
 * I think I need to place the code somewhere in the function file. My related posts
   are taxonomy and thumbnail/gallery related functionality.
 * Thank you,
    Ibra
 *  Plugin Author [keesiemeijer](https://wordpress.org/support/users/keesiemeijer/)
 * (@keesiemeijer)
 * [11 years, 9 months ago](https://wordpress.org/support/topic/post-date-under-post-title/#post-5337531)
 * Does it work with the links format?
 * For adding the date to the post thumbnail captions you’ll need to use this filter.
   
   [http://keesiemeijer.wordpress.com/related-posts-by-taxonomy/filters/#related_posts_by_taxonomy_caption](http://keesiemeijer.wordpress.com/related-posts-by-taxonomy/filters/#related_posts_by_taxonomy_caption)
 * Here’s an example for in your theme’s functions.php:
 *     ```
       add_filter( 'related_posts_by_taxonomy_caption', 'km_rpbt_add_date_to_caption', 10, 3);
       function km_rpbt_add_date_to_caption($caption, $related, $args ) {
   
       	$caption .= '<span class="related-post-date">';
       	$caption .= get_the_date( get_option( 'date_format' ), $related->ID);
       	$caption .= '</span>';
   
       	return $caption;
       }
       ```
   
 * btw:
    consider creating a [child theme](http://codex.wordpress.org/Child_Themes)
   instead of editing your theme directly – if you upgrade the theme all your modifications
   will be lost. Or [create a plugin](https://wordpress.org/plugins/pluginception/)
   with the code above.
 *  Thread Starter [ananzeh25](https://wordpress.org/support/users/ananzeh25/)
 * (@ananzeh25)
 * [11 years, 9 months ago](https://wordpress.org/support/topic/post-date-under-post-title/#post-5337556)
 * Thank you keesiemeijer
 * Working as it suppose to. The date didn’t work with the link template.
 * Here what I tried to do is to replace the title with the date and it is working.
   I did that because i work in photos gallery theme.
 *     ```
       add_filter( 'related_posts_by_taxonomy_caption', 'link_related_caption', 10, 2 );
       function link_related_caption( $caption, $post ){
           $caption = get_the_date( get_option( 'date_format' ), $related->ID);
           return $caption;
       }
       ```
   
 * I was wondering though how to locate the date before the title.
 *  Thread Starter [ananzeh25](https://wordpress.org/support/users/ananzeh25/)
 * (@ananzeh25)
 * [11 years, 9 months ago](https://wordpress.org/support/topic/post-date-under-post-title/#post-5337558)
 * The above code doesn’t bring the right date here the right one:
 *     ```
       add_filter( 'related_posts_by_taxonomy_caption', 'link_related_caption', 10, 2 );
       function link_related_caption( $caption, $related, $args ){
           $caption .= '<span class="related-post-date">';
           $caption = get_the_date( get_option( 'date_format' ), $related->ID);
           $caption .= '</span>';
           return $caption;
       }
       ```
   
 * Still can’t figure how to locate the post title under the post date.
 *  Plugin Author [keesiemeijer](https://wordpress.org/support/users/keesiemeijer/)
 * (@keesiemeijer)
 * [11 years, 9 months ago](https://wordpress.org/support/topic/post-date-under-post-title/#post-5337559)
 * Try it with this:
 *     ```
       add_filter( 'related_posts_by_taxonomy_caption', 'link_related_caption', 10, 3 );
       function link_related_caption( $caption, $related, $args ) {
       	$date = '<span class="related-post-date">';
       	$date .= get_the_date( get_option( 'date_format' ), $related->ID );
       	$date .= '</span>';
       	return $date . $caption;
       }
       ```
   
 *  Thread Starter [ananzeh25](https://wordpress.org/support/users/ananzeh25/)
 * (@ananzeh25)
 * [11 years, 9 months ago](https://wordpress.org/support/topic/post-date-under-post-title/#post-5337560)
 * It works.
    Thank you!
 *  Plugin Author [keesiemeijer](https://wordpress.org/support/users/keesiemeijer/)
 * (@keesiemeijer)
 * [11 years, 9 months ago](https://wordpress.org/support/topic/post-date-under-post-title/#post-5337561)
 * You’re welcome. I’m glad you’ve got it resolved 🙂
 *  [bmg](https://wordpress.org/support/users/bridgetg/)
 * (@bridgetg)
 * [11 years, 9 months ago](https://wordpress.org/support/topic/post-date-under-post-title/#post-5337627)
 * Hey, I’m a little lost with this. Can you specify where I’m supposed to post 
   this code? I put it in themes functions.php file and it didn’t work. I want to
   display the date underneath the image above the title. Thank you!
 *  Plugin Author [keesiemeijer](https://wordpress.org/support/users/keesiemeijer/)
 * (@keesiemeijer)
 * [11 years, 9 months ago](https://wordpress.org/support/topic/post-date-under-post-title/#post-5337628)
 * Yes, in your theme’s functions.php.
 * Does it still show the title without the date?
 *  [bmg](https://wordpress.org/support/users/bridgetg/)
 * (@bridgetg)
 * [11 years, 9 months ago](https://wordpress.org/support/topic/post-date-under-post-title/#post-5337640)
 * Ok I added the code you provided below to functions.php
 *     ```
       add_filter( 'related_posts_by_taxonomy_caption', 'link_related_caption', 10, 2 );
       function link_related_caption( $caption, $related, $args ) {
       	$date = '<span class="related-post-date">';
       	$date .= get_the_date( get_option( 'date_format' ), $related->ID );
       	$date .= '</span>';
       	return $date . $caption;
       }
       ```
   
 * The title is showing, so now I’m assuming I add a code to show the date on the
   template. I tried <span class=”related-post-date”><?php echo get_the_date(); ?
   ></span> but that only shows the date for one post, if that’s the code where 
   do I place it?
 * If not, What do I add to the related-posts-thumbnails.php file? I want the date
   to be above the title. Thank you! 🙂
 *  Plugin Author [keesiemeijer](https://wordpress.org/support/users/keesiemeijer/)
 * (@keesiemeijer)
 * [11 years, 9 months ago](https://wordpress.org/support/topic/post-date-under-post-title/#post-5337645)
 * For adding the date to the thumbnail gallery captions you don’t have to add code
   to the templates.
 * Try changing this in your theme’s functions.php file:
 *     ```
       add_filter( 'related_posts_by_taxonomy_caption', 'link_related_caption', 10, 2 );
       ```
   
 * to this:
 *     ```
       add_filter( 'related_posts_by_taxonomy_caption', 'link_related_caption', 10, 3 );
       ```
   
 *  [bmg](https://wordpress.org/support/users/bridgetg/)
 * (@bridgetg)
 * [11 years, 9 months ago](https://wordpress.org/support/topic/post-date-under-post-title/#post-5337646)
 * It worked! Thank you!!

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

The topic ‘Post date under post title’ is closed to new replies.

 * ![](https://ps.w.org/related-posts-by-taxonomy/assets/icon.svg?rev=1115231)
 * [Related Posts by Taxonomy](https://wordpress.org/plugins/related-posts-by-taxonomy/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/related-posts-by-taxonomy/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/related-posts-by-taxonomy/)
 * [Active Topics](https://wordpress.org/support/plugin/related-posts-by-taxonomy/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/related-posts-by-taxonomy/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/related-posts-by-taxonomy/reviews/)

 * 13 replies
 * 3 participants
 * Last reply from: [bmg](https://wordpress.org/support/users/bridgetg/)
 * Last activity: [11 years, 9 months ago](https://wordpress.org/support/topic/post-date-under-post-title/#post-5337646)
 * Status: resolved