There is now an “archives” shortcode

  • Unknown's avatar

    It pays to snoop around once in a while. While looking at the shortcodes support document I happened on a new one; Archives. http://support.wordpress.com/archives-shortcode/

    It will create a list of your posts on a page and also has various “options” you can set. To see a sample (basic with no options) take a look at http://opposablethumbz.wordpress.com/shortcode-archives/ . I haven’t played with all the “options” yet so I cannot give feedback on those.

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

  • Unknown's avatar

    Thanks for letting us know about this. Now I know what else needs to be styled when I make/port a Sandbox skin… especially now that I was about to release a new one (and which I’m currently using). I’ll add those elements before I release the code.

  • Unknown's avatar

    You’re welcome. The one on my blog here is a little bland so I’ll have to CSS it up a little, but this is a good feature. Many have asked for such a thing.

  • Unknown's avatar

    The short code is not well implemented. I was pulling my hair out wondering why my styles wouldn’t get applied and the reason why is because they didn’t implement the code well when the short code is parsed…

    Instead of doing this:

    <p>
    <strong>
    All
    </strong>
    <br />
    </p>
    <ul>
    	<li>
    		<a title="New Skin and New Blog" href="http://sandboxskins.wordpress.com/2009/07/23/new-skin-and-new-blog/">
    			New Skin and New Blog
    		</a>
    	</li>
    	<li>
    		<a title="New Wallpapers" href="http://sandboxskins.wordpress.com/2009/07/13/new-wallpapers/">
    			New Wallpapers
    		</a>
    	</li>
    	<li>
    		<a title="Syfy’s House of Imagination" href="http://sandboxskins.wordpress.com/2009/07/09/syfys-house-of-imagination/">
    			Syfy’s House of Imagination
    		</a>
    	</li>
    </ul>

    They did this:

    <p>
    <strong>
    All
    </strong>
    <br />
    </p>
    
    	<li>
    		<a title="New Skin and New Blog" href="http://sandboxskins.wordpress.com/2009/07/23/new-skin-and-new-blog/">
    			New Skin and New Blog
    		</a>
    	</li>
    	<li>
    		<a title="New Wallpapers" href="http://sandboxskins.wordpress.com/2009/07/13/new-wallpapers/">
    			New Wallpapers
    		</a>
    	</li>
    	<li>
    		<a title="Syfy’s House of Imagination" href="http://sandboxskins.wordpress.com/2009/07/09/syfys-house-of-imagination/">
    			Syfy’s House of Imagination
    		</a>
    	</li>

    Notice what’s wrong with that?

    QA any one?

  • Unknown's avatar

    They left out the

    <ul>
    </ul>
  • Unknown's avatar
  • Unknown's avatar

    It also has that obnoxious “shortcode archive” title at the top of the page which has to go.

    Devblog, are you going to alert them to the missing tags?

  • Unknown's avatar

    Oops, I just realized the “obnoxious title” at the top of the page was what I named the page.

    Where did I put that rock I crawl under?

  • Unknown's avatar

    Devblog, are you going to alert them to the missing tags?

    Sure, I’ll do it.

  • Unknown's avatar
  • Unknown's avatar

    Would it be a good idea to ad a modlook tag as well?

  • Unknown's avatar

    I added the modlook tag. They can monitor this for other things that people might find.

  • Unknown's avatar

    @tsp: Thanks for posting this!

    Interesting detail: In contrast to most shortcodes, it works in a text widget.

    (Off-topic, but also news: now all themes except Monotone are widget-enabled.)

  • Unknown's avatar

    You’re welcome. All themes being widget enabled is welcome news.

  • Unknown's avatar

    Nice.

    Now, there’s another bug. This bug can be seen when you use ‘before’ and ‘after’ parameters:

    [archives type=weekly limit=17 before=some-text after=some-more-text]

    it produces this:

    # some-textJuly 19, 2009–July 25, 2009some-more-text
    # some-textJuly 12, 2009–July 18, 2009some-more-text
    # some-textJuly 5, 2009–July 11, 2009some-more-text

    No space between ‘text’ and ‘July’ nor ‘2009’ and ‘some’

  • Because we do not want to force a space on users, any spacing will need to be added within the parameters of the shortcode. Here is an updated example that should work:

    [archives type=weekly limit=17 before='some-text ' after=' some-more-text']

    We have updated our examples to include the quotation marks when using the before and after attributes.

  • Unknown's avatar

    Because we do not want to force a space on users

    Really? I don’t see a scenario where the user would not want to have a space… but sure, if adding quotation marks does the job, then no problem.

  • Unknown's avatar

    ummmmm,sorry peeps, but I have no idea what y’all talkin’ about up there. I was so excited to see that feature but I can’t get it to work at all. I added the page, I did what they said to do and I keep getting an error message. I could cry. What am I doing wrong? Can anyone help a technologically impaired person, please…

  • Unknown's avatar

    Paste the code that you are using here between backticks (the key to the left of the #1 typically) so we can take a look at it. Also, if the page has been published, we need a link to it so we can take a look at it.

  • The topic ‘There is now an “archives” shortcode’ is closed to new replies.