Take the 2-minute tour ×
WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

I'm displaying list or archives using

<?php get_archives('monthly', '', 'html', '', '', FALSE); ?>

and my list displays

December 2012 November 2012 etc

However I would like to format this to display:

12.12 11.12 10.12 etc

Any ideas?

share|improve this question
2  
Don't know about the date format unfortunately, but get_archives has been deprecated and replaced with wp_get_archives –  jzatt Dec 4 '12 at 11:09

2 Answers 2

up vote 1 down vote accepted

There is but the filter sucks, it only gives you the link HTML:

add_filter( 'get_archives_link', 'wpse74891_archives_link' );
function wpse74891_archives_link( $link ) {
    $link = preg_replace_callback( '/>([A-Za-z]+\s+\d{4})/', function( $matches ) {
        return '>' . date( 'm.y', strtotime( $matches[1] ) );
        }, $link );
    return $link;
}

Using this method you can pass in any date format you want for the link at least.

share|improve this answer
    
mate you are star, that did the trick :) –  jmysona Dec 4 '12 at 17:27

Try changing the date display format under Settings > General in your WordPress admin. Choose the custom option and enter y.m into the box.

enter image description here

If you're feeling adventurous, there are lots of other formatting tags available

share|improve this answer
    
The date format in settings only applies to post dates - the archive links are kinda hard coded. –  sanchothefat Dec 4 '12 at 12:05
    
yes that doesn't work –  jmysona Dec 4 '12 at 17:23

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.