WordPress.org

Ready to get started?Download WordPress

Forums

Paginating wp_get_archives (2 posts)

  1. anoopd
    Member
    Posted 11 months ago #

    Hi,
    What would be the best way to to achieve this in a category-{slug}.php

    2013 | 2012 | 2011 | Previous

    Shows all archives in {slug} and on year 2013.

    I got the year links easily by passing 'type'=>'yearly' to wp_get_archives and restrict to specific category by using "Archives for a category" plugin but was unable to filter posts to year 2013 (I needed domain.com/2013/ instead of domain.com/category/slug) .

    I did a pretty nasty hack (don't know whether i can call it a hack) .. i made a custom WP_Query to work on current year and display posts of current category if the current url does have "slug" in it and if it doesn't it will go with the usual archive loop ...

    Still I wasn't able to get the pagination part working .Should i use a custom query to display years and do the pagination totally avoiding wp_get_archives() or is there any other way to do this

  2. keesiemeijer
    moderator
    Posted 11 months ago #

    If I understand correctly you want these links on a category archive:
    2013 | 2012 | 2011 | Previous
    pointing to a the correct date based archive:
    domain.com/2013/?slug=categoryslug

    Can you show us the archive template where you do your custom query?

Reply

You must log in to post.

About this Topic