Paginating wp_get_archives (2 posts)

  1. anoopd
    Posted 2 years ago #

    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
    Posted 2 years 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:

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

Topic Closed

This topic has been closed to new replies.

About this Topic