Archive Shortcode

  • Unknown's avatar

    I was wondering if there was a way to customize the Archives Shortcode so that it would return posts only for specific time periods. For example, could I set up 3 Archives Shortcode dropdowns in a table on a page. Have each dropdown return posts from a different period. i.e. one dropdown returns posts from 2010 to 2020, another to return posts from 2000 to 2009, another to return posts from 1990 to 1999 etc.

    Thanks, Tim

    The blog I need help with is: (visible only to logged in users)

  • Unknown's avatar

    …or, could I set it up so that I could return both years and have months as a sub-level? or months alongside the years?

  • Hi Tim,

    Hmm, I don’t think so, because the shortcode parameters only allow you to specify by “last” however many.

    You could set up manual links to these archives with just a regular Text widget, though. So for example:

    <a href="http://flattiresandslowboats.com/2013/">2013 Archive</a>

    You can also just display them all yearly:

    [archives type=yearly]

    But if you want to break them out into a mix of yearly and monthly, you’d need to use manual links.

  • Unknown's avatar

    Eventually the manual link may be the way I need to go.

    For right now I have added two archive sections on a dedicated archive page;
    [archive type=monthly showcount=true] this gives month, year, count
    [archive] this lays out a list post by post underneath the above

    If I was to use a text widget I could also add this to a dedicated page, yes? and the only text that would show up is the “2013 Archive” or whatever I added?

    When that link is clicked would it would show all the posts for that time period?

  • Hi Tim,

    You can make any widget display only on a certain page by using the visibility settings:
    http://en.support.wordpress.com/widgets/#widget-visibility

    and the only text that would show up is the “2013 Archive” or whatever I added?
    When that link is clicked would it would show all the posts for that time period?

    Correct. :)

  • Unknown's avatar

    ahhh… thank you. I had the meaning of Visibility Settings all wrong. I thought it meant you could eliminate certain pages or posts. Like some of the other widgets (Tag Cloud) where you can exclude certain tags.

    So I could use a Text Widget and even though it lives in the sidebar it would not necessarily show there…if I have the Visibility set to show on a certain page?

  • Hi Tim,

    Basically it lets you pick which pages you want a given widget to show on. So, you can either eliminate it from one or more, or you can specify that it should specifically show on one or more (and not the others).

  • Unknown's avatar

    But you would configure it as if it was going in the sidebar, right?

  • Correct. It does go in the sidebar (or footer) – the visibility setting lets you control which pages’ sidebars the widget shows in and which it does not.

  • Unknown's avatar

    Thanks; I appreciate the help.
    Tim

  • The topic ‘Archive Shortcode’ is closed to new replies.