Forums

Weekly archives, show only first date in title (5 posts)

  1. iMatt
    Member
    Posted 3 years ago #

    Hi,

    I'm trying to setup my blog to have weekly archives available. I can set the archives to display 'Weekly' but the problem is that the link then reads as October 22, 2006 - October 28, 2006. I would like the link to only display the first date of the week, in this case October 22, 2006.

    You can see an example of what I am looking for at http://www.thesuperficial.com. I realize that they are on MovableType but certainly this can be done in Wordpress... or at least I hope.

    Thanks in advance!

  2. Kafkaesqui
    Moderator
    Posted 3 years ago #

    Try this bit of PHP magic:

    http://wordpress.pastebin.ca/243988

    You would replace:

    <?php get_archives('weekly'); ?>

    in your theme template with the code I've linked to. There'll be a tiny bit of overhead due to the output buffering going on to collect get_archives() output and parse out the end date, but it should work.

    A better solution would be to copy the code for the get_archives() function, remove the end date from the weekly display, and create ones own version of get_archives() (that is, as a plugin or a new function embedded in a theme).

  3. iMatt
    Member
    Posted 3 years ago #

    Excellent, thank you! Exactly what I was looking for.

    Question regarding this. I have a post that was made on Nov 5th (Sunday). For some reason the archives link displays for Nov 5th but when clicked on it shows zero posts. The Nov 5th post that was made shows up in the prior week, Oct 29th. I have my blog set to display Sunday as the start of the week.

  4. iMatt
    Member
    Posted 3 years ago #

    Anything? :)

  5. Kafkaesqui
    Moderator
    Posted 3 years ago #

    Sorry I can't say why you'd see this. What version of WP are you using?

Topic Closed

This topic has been closed to new replies.

About this Topic