• Hello there,

    I’ve been using a real-time gold price widget in one of my articles. The title of the article is like – Gold price on February 15 2012. I want to change the date part of the title meta automatically- on next day it should be February 16 2012 without altering “Gold Price on” part. Can you you suggest a plugin/hack to enable this feature in WordPress.

    Many thanks in advance.
    John

Viewing 1 replies (of 1 total)
  • You can use a filter on the title. Put this in your functions.php:

    function put_date_in_title($title) {
       $date = date_i18n('F j Y');
       $title = str_replace('=today=',$date,$title);
       return $title;
    }
    add_filter('the_title','put_date_in_title');

    But be careful, any syntax errors will make it impossible to access your site. You would need to correct them using ftp or a file manager from your hosting service.

    You would have a title like this: ‘Gold price on =today=’.

Viewing 1 replies (of 1 total)
  • The topic ‘Automatically change post title meta with date.’ is closed to new replies.