Is it possible to edit the output of the wp_get_archives link at all?

I'd like to prefix the link with a string.

At the moment the output is something like url.com/2013/10 what I'd like it to do would be url.com/gallery/2013/10. "gallery" being a custom post type, at the moment the get_archives just goes to the standard posts archive, which is what it's supposed to do.

Is it possible to duplicate the function and add a prefix somehow there?

Any help greatly appreciated :)

  • What have you tried? Have you used any of the arguments documented in the Codex for wp_get_archives()? – Chip Bennett Oct 20 '13 at 21:56
  • I've tried a few, however looking again, I've just spotted the format 'custom' option, then use the before & after. Is that possible to edit the whole link? – jamie Oct 21 '13 at 9:12
  • I think wp_get_archives() isn't your issue at all. I think you're really wanting to know how to modify the permalink structure for your CPT? – Chip Bennett Oct 21 '13 at 12:27
  • Got my custom post type set up as /gallery/ which works fine, the problem arrises when I try to use wp_get_archives, so whats happening is: I have 2 separate archives, one for normal posts and I have another for gallery, however when I call wp_get_archives, it gets the archive list of the normal posts (which is right) but I'd like to prepend the archive links it gives me with /gallery/. Sorry if i'm being very unclear - thanks for your help thus far – jamie Oct 21 '13 at 16:04

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.