Reputation: 4944
I am using a WordPress blog theme created by someone named Scott Wallick. Here is his website. FYI, I'm using the "Barthelme" theme.
Anyway, this theme prints out the date as follows: August 5, 2009 is displayed as "2009 08 05". I would like to change the display to the following format: 5 Aug 2009.
How do I do this?
I found the function below in the WordPress code. Could I just somehow change the code below to make it do what I asked above? If so, what changes should I make?
function barthelme_date_classes($t, &$c, $p = '') {
$t = $t + (get_option('gmt_offset') * 3600);
$c[] = $p . 'y' . gmdate('Y', $t);
$c[] = $p . 'm' . gmdate('m', $t);
$c[] = $p . 'd' . gmdate('d', $t);
$c[] = $p . 'h' . gmdate('h', $t);
}
Upvotes: 2
Views: 264
Reputation: 1904
In the Barthelme theme, line 23 of index.php reads
<span class="entry-date">
<abbr class="published" title="<?php the_time('Y-m-d\TH:i:sO'); ?>">
<?php unset($previousday); printf(__('%1$s', 'barthelme'), the_date('Y m d', false)) ?>
</abbr>
</span>
Change it to
<span class="entry-date">
<abbr class="published" title="<?php the_time('Y-m-d\TH:i:sO'); ?>">
<?php unset($previousday); printf(__('%1$s', 'barthelme'), the_date('j M Y', false)) ?>
</abbr>
</span>
Upvotes: 0
Reputation: 54056
Try the following:
function barthelme_date_classes($t, &$c, $p = '') {
$t = $t + (get_option('gmt_offset') * 3600);
$c[] = $p . 'j' . gmdate('j', $t);
$c[] = $p . 'M' . gmdate('M', $t);
$c[] = $p . 'Y' . gmdate('Y', $t);
$c[] = $p . 'h' . gmdate('h', $t);
}
I just changed the order in which every date element is stored, and used the format you asked for.
Upvotes: 2