Take the 2-minute tour ×
WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

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!

share|improve this question
    
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 Answer 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.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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