WordPress blog tarih fonksiyonu

2 Cevap php

Ben Scott Wallick adında birisi tarafından oluşturulan bir WordPress blog tema kullanıyorum. Here onun sitesidir. Bilginize, ben "Barthelme" temasını kullanıyorum.

Neyse, şöyle Çıkış tarihi bu tema yazdırır: 5 Ağustos 2009 "2009 08 05" olarak görüntülenir. 5 Ağustos 2009: Ben aşağıdaki biçimde görüntüsünü değiştirmek istiyorum.

Bunu nasıl yaparsınız?

I WordPress kodu aşağıdaki işlevi bulundu. Ben sadece her nasılsa ben yukarıda sordum ne yapmak için aşağıdaki kodu değiştirebilir mi? Eğer öyleyse, ben ne gibi değişiklikler yapmak gerekir?

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 Cevap

Aşağıdaki deneyin:

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);
}

Ben sadece her tarih eleman depolandığı düzeni değişti, ve istediğin biçimi kullanılır.

Barthelme tema, index.php 23 okur hat

<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>

Bunu değiştirin

<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>