WordPress blog date function

I am using a WordPress blog theme created by someone named Scott Wallick. Here is his website. FYI, I'm using the "Barthelme" theme.

Either way, this topic prints the date like this: August 5, 2009 is displayed as "2009 08 05". I would like to change the display to the following format: August 5, 2009

How to do it?

I found below function in WordPress code. Can I somehow modify 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);
}

      

+2


source to share


2 answers


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 each date element is stored and used the format you requested.

+2


source


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>

      

0


source







All Articles