I'm working all things in designing the Worpress default theme. I emerged against an problem of formatting archive links.

The default theme uses wp_get_archives function defined in general-template.php. The creation of the function is customisable, although not customisable enough for me personally.

I'm able to achieve everything I wish to do by essentially reimplementing that specific function during my functions.php file however i am reluctant to do this because it introduces regression issues as Wordpress will get up-to-date. wp_get_archives does all of the lower level things like constructs a DB query and caches the DB results. I would love to prevent carrying this out basically can.

One other way available to me would be to create get_archives_link filter after which the hyperlink HTML has already been formatted and that i will have to run a lot of regex to understand it. This appears completely backwards in my experience because it would completely get rid of the performance.

Here is what I would like output:

<li><a href="/year/01">JAN</a></li>
<li class="current"><a href="/year/02">FEB</a></li>
<li>MAR</li> <!--no blog entries this month-->
...

So far as I can tell wp_get_archives has hardcoded text from the anchor:

$text = sprintf(__('%1$s %2$d'), $wp_locale->get_month($arcresult->month), $arcresult->year);

Then thre is definitely an problem of adding several weeks which have no posts, I'd prefer to approach that without parsing the written text. I Quickly will have to add the present class (once the URL is one thing like .../2009/12).

I have really got an answer that actually works utilizing a copy of wp_get_archives. Is the best way to do things and will i worry an excessive amount of about nothing?

EDIT I suppose the question for you is could it be OK to create your oen SQL for any Wordpress theme? And when it's, what's the best practice by doing this.

Should you define it inside your functions.php file in your active theme, there should not usually be considered a regression problem.

However, this is not quite true when altering the default theme. Should you be then to upgrade Wordpress by uploading the whole wordpress source, it might overwrite functions.php.

To resolve this, duplicate the whole folder that contains the Default theme. Within the new copy, edit style.css and alter line 2 (theme title) to a different theme title.

Theme Name: WordPress Default

Wordpress will see an additional theme, which you'll edit for your hearts' content.