I Need to use Month , year in my all archives and pages of my wordpress site

I need to have month/year in all my pages in my wordpress site .

For example : If that the page title is ” Online exams ” I need to have it like ” October 2014 online exams” . I have around 10-12 pages and in all archives . I tried with %month% in the page title but this did not work . I can Rename all the pages with the correct code if i get instead of renaming every month .

I had seen many sites using this . Kindly help me with this .

Thank you.

Solutions Collecting From Web of "I Need to use Month , year in my all archives and pages of my wordpress site"

Please put below code in your functions.php file. You will need to create custom field named ‘custom_post_name’ and set the custom field text to what you want to add to page title.

function alter_page_title(){
    global $post;
    $current_page_title = $post->post_title;
    /* Check if lower case version of current page title is = online exams. */
    if (strtolower($current_page_title) == "online exams"){
        /* If yes then get value of custom_post_name meta field and add that to beginning of title & return */
        $custom_title_to_append = get_post_meta($post->ID, custom_post_name, true);
        return $custom_title_to_append. " ".$current_page_title;
    } else {
        /* else return title as is */
        return $post->post_title;
    }
}
add_action('the_title', 'alter_page_title');