2

Is there a way to add in title a date but with another color, like in iMDb titles?

Like in this title (click on it): http://www.imdb.com/title/tt1606378/

To be more clear, see this picture

The result is this:see this picture

Thanks!

1
  • It works perfect. Thanks! There are several problems. This function changes all data on my website, it add the date time everywhere. I would like to add the date only in title. Is there a way to add/or edit data (2012) manually? Thank you very much! – Blanka Nov 1 '12 at 6:24
1

add this code in functions.php file

add_filter( 'the_title', 'ta_modified_post_title');
function ta_modified_post_title ($title) {
    global $post;   
    $mynewdate = strtotime($post->post_date); 
    $title = $title.'<span class="modified">'.date('Y',$mynewdate).'</span>'.'-<span class="modified">'.date('d',$mynewdate).'</span>-'.'<span class="modified">'.date('m',$mynewdate).'</span>';
  return $title;
}

modify date by your own way.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.