Support » Themes and Templates » Sidebar Archives Date Format

  • Ive been trying to do this for a while now, the date format on my sidebar is.. eg. “December 2005”..

    How would I change that to “Dec 05”?

    Thanks. Alex

Viewing 4 replies - 1 through 4 (of 4 total)
  • You would change the value of the_date or the_time to be from:

    the_date('F Y')

    to more like:

    the_date('M y')

    Here‘s the codex article explaining it. Here‘s the full syntax.

    Hey bud, thanks for the reply. I dont quite think I structured the question correctly.

    My Sidebar uses the function wp_get_archives(). I did a little digging, in that function it queries the post table and then returns the post_date as a month.. the line is..

    wp-includes/template-functions-general.php. Line 333.

    $arcresults = $wpdb->get_results("SELECT DISTINCT YEAR(post_date) AS year, MONTH(post_date) AS month, count(ID) as posts FROM $wpdb->posts WHERE post_date < ‘$now’ AND post_date != ‘0000-00-00 00:00:00’ AND post_status = ‘publish’ GROUP BY YEAR(post_date), MONTH(post_date) ORDER BY post_date DESC” . $limit);

    from this i can see a function MONTH() around the post_date.. does anyone know where this function is defined because if im reading correctly it take the integer value from the database and converts it into the String value that it displays through the $text variable.

    Thanks Alex.

    Oh good lord — you turned a question I thought I could answer easy into a quest…

    Ok, what I’ve deduced from the amazing PHP WordPress Cross Reference is that MONTH(), though it looks like a function, is not. It’s actually part of an array that’s pulling MySQL queries. My basis for such a hypothesis: $wpdb->get_results(... and the fact that the commands are all in CAPS. $wpdb is defined in wp-includes/wpdb.php and has everything to do with talking to MySQL.

    Hope this explains it, but bear in mind I am not a PHP expert. It’s just incredible what a little color-coding will do.

    And hey, what was wrong with the_date('M y') in the first place? 😛

    To clarify and extend on Orin’s reply ..

    MONTH() is sort of a function, not in PHP or WordPress .. but a MySQL routine if you will ..

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘Sidebar Archives Date Format’ is closed to new replies.