• Is there a way to change the date that’s displayed on the static pages? I update them often and it would be nice if i could edit the timestamp on the pages. I am aware that you can do this for individual posts, though… it would be great if pages supported this as well.

    Oh yes, I’m running WP 1.5 gamma (2/3/05), if that helps.

Viewing 3 replies - 1 through 3 (of 3 total)
  • Here’s a quick bit of code shamelessly ripped and tweaked from wp-includes/template-functions-general.php‘s the_date function. Put the following into my-hacks.php and enable my-hacks support in Options->Miscellaneous.

    <?php
    function the_page_date($d='', $before='', $after='', $echo = true, $page_date_type='modified') {
    global $id, $post, $day, $previousday, $newday;
    $the_date = '';
    if ($page_date_type=='modified') {
    $db_date = $post->post_modified;
    } else {
    $db_date = $post->post_date;
    }
    if ($day != $previousday) {
    $the_date .= $before;
    if ($d=='') {
    $the_date .= mysql2date(get_settings('date_format'), $db_date);
    } else {
    $the_date .= mysql2date($d, $db_date);
    }
    $the_date .= $after;
    $previousday = $day;
    }
    $the_date = apply_filters('the_date', $the_date);
    if ($echo) {
    echo $the_date;
    } else {
    return $the_date;
    }
    }
    ?>

    Then change the reference in your page.php template from the_date(...) to the_page_date(...)

    This could be made a plugin as well, but this was quick.

    EDIT: for a slightly more legible version of the above, see this pastebin.

    Thread Starter bonfire

    (@bonfire)

    Works like a charm, thanks a ton!

    I hate that you can’t edit the date too, so I wrote a simple plugin for it: http://www.vapourtrails.ca/wp-plugins

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Static Page date’ is closed to new replies.