Improve Archives widget to display by year or month

  • Unknown's avatar

    The current Archives widget allows for a monthly breakdown or a dropdown menu. It would be great to have an option to display by year or by month, and especially by year with the last year by month – with or without counts.

    I’ve been blogging for 2.5 years so the monthly list is getting long. However, I do want the option to brag about the posting pace, for which the dropdown menu is not an answer.

    I am aware of the following topic:
    https://en.forums.wordpress.com/topic/archives-widget-via-years-not-months?replies=3

    Thanks.

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

  • Unknown's avatar

    @alicht2014,

    Have you see the Create an Archive using the Archives Shortcode support page? It may provide a practical workaround regarding your idea. Using archives shortcode, you may easily create two lists, and place them in the same text widget, as follows:

    • 1. archives yearly list:
      [archives type=yearly]
    • 2. archives monthly list:
      [archives type=monthly limit=12]

    If the monthly list is only to show those of the present year, then you may adjust the limit each month. For example, now the limit would be “7” to show the seven months from January to July this year.

    To identify the monthly list as a list of months of this year, you may insert “2017” above the shortcode.

  • Unknown's avatar

    “Have you seen…”

  • Unknown's avatar

    Hi Musicdoc1,

    Thanks much for the quick response!

    So this is all new to me. I hope you don’t give me too much credit as I am totally HTML illiterate, but I will surely dig into this. Very interesting.

    Best regards.

  • Unknown's avatar

    Hi again,

    The issues began rather quickly:) I’d be happy for your advice on the following:

    Suppose I have 20 posts for 2015, 20 for 2016, and 7 so far for 2017. I’d like to display 2015-2016 on a yearly basis and 2017 on a monthly basis. Can I limit the yearly display to 2015-2016 by using “before” and “after” tags? What is the syntax for using those? Do they link to the posting date?

    Thanks.

  • Unknown's avatar

    The archives yearly and monthy shortcodes would produces lists that look like the following:

    1.archives yearly

    • 2017
    • 2016
    • 2015

    2. archives monthly list:

    • July 2017
    • June 2017
    • May 2017
    • April 2017
    • March 2017
    • February 2017
    • January 2017

    Either of those can be displayed as drop-down menus inserting “format=option” into the corresponding code. Example:
    [archives type=yearly format=option]

    Regarding the “before” and “after” customization options:
    If you add the following to the code: before=’some bit of text’ or after=’some other bit of text’, then it will add that same text before or after each item in the list. I don’t know how the before and after options can be used beyond that, though the references to a “custom” format type and HTML tags in the support page suggest that more can be done with those options.

    You may add a “modlook” tag to the sidebar at right to call for staff attention if you’d like to ask staff about it. Alternatively, you may try the https://wordpress.com/help/contact option. Staff is available over live chat there between 7:00am and 8:00pm Eastern Standard Time.

  • Unknown's avatar

    I don’t know if you can limit the yearly list to 2015 and 2016. Obviously, if you insert “limit=2” it will give you 2016-2017. I’ve been trying to figure out how to do that.

  • Unknown's avatar

    I suspect that the “before” and “after” options having nothing to do with dates, and can only affect what, if anything, goes before or after each item in the list.

  • Unknown's avatar

    Hi,
    Yeah, this looks good.
    I believe that Blogger has that feature of yearly-monthly archive, because I saw it somewhere.
    Thanks!

  • Unknown's avatar

    Silly me. This is all not too useful, unfortunately.

    The “Create an Archive using the Archives Shortcode” support page clearly says that these configurable archives can only be created in a new page or post. What

      IS

    needed is a configurable archive in the sidebar.

    And yes, it is Blogpost that has the nifty sidebar archive.

    Oh, bother. Would be nice to have.

    Thanks anyway.

  • Howdy –

    Thank you musicdoc1 for the advice shared here :) It’s very appreciated!

    alicht2014 – the short codes provided will work in a plain text widget. Here is a screen shot of the results from one of my test sites: https://cloudup.com/cwr-eps_p0G

    On the left you’ll see “Archives” and the monthly shortcode results. The “Archive” is the yearly shortcode.

    To do this, you’ll need to open up your Customizer tab and click on Widgets. Search for Text widget and add. Give the widget a title, and add the shortcode to the text body. Save the changes and view the site.

  • Unknown's avatar

    Thanks for the swift response, Liz. Much appreciated.
    Will try.

  • Unknown's avatar

    A follow-up: This useful tip should be included in the Archives Shortcode support page, too.

  • Unknown's avatar

    staff-zinnia,

    You’re welcome :-)

    @alicht2014,

    Don’t forget, as I mentioned above, the list produced by any archives shortcode can be displayed as a drop-down menu by inserting “format=option” into the shortcode. Example:
    [archives type=yearly format=option]

  • Unknown's avatar

    A follow-up: This useful tip should be included in the Archives Shortcode support page, too.

    I’d like to second that emotion. :)

  • Good morning everyone :)

    There is an image showing the check box for the ‘drop down option’ under Configuration in that support doc. https://en.support.wordpress.com/widgets/archives-widget/

    What you’re asking is that we add the instructions to use the shortcodes drop down on this guide https://en.support.wordpress.com/archives-shortcode/?

    Please forgive my case of the Mondays. I just want to be sure that I’m understanding the request properly :)

  • Unknown's avatar

    The first paragraph at https://en.support.wordpress.com/archives-shortcode/ says:

    “You can easily and quickly create an archive index of your WordPress.com blog’s posts using the [archives] shortcode. To create an archive index for your blog, simply add a new page or post and type the following shortcode into your visual editor:…”

    This paragraph should also mention that an archive can be created in a plain text widget and refer to how to do this. Adding a new page or post for an archive is not very practical…

    Thanks.

  • Unknown's avatar

    @alicht2014,

    The same opening paragraph of the Create an Archive using the Archives Shortcode support page that you quoted from above continues as follows:

    By default, the shortcode will produce an index/listing of all published posts on your blog. You can use multiple shortcodes on one post/page and also add it to a Text Widget for use in your sidebar.

  • Unknown's avatar

    I’d also said in my first post here, above the two example shortcodes:
    “Using archives shortcode, you may easily create two lists, and place them in the same text widget…”

  • The topic ‘Improve Archives widget to display by year or month’ is closed to new replies.