WordLog

A weblog authored by Carthik about the latest in the WordPress world.

Wednesday, March 09, 2005

Specify a random order for your links

Filed under: — Carthik @ 2:28 am

This is an old trick – Podz reminds users of it whenever someone asks the question at the forums.

The question is “How do I order category links that are displayed on my weblog just the way I want them to – in some order that is is not alphabetic, or in any sort of organized order, really?”

That sure was difficult to frame! Well, point it, you want some category link to be the first, some other one to be second, and so on and so forth.

The way you do it is, add underscores to the beginning of the name of the category. so, say I want the category called “Noticed!” to be the first in the list of categories displayed, no matter what, then I rename it to “_Noticed!” through the admin interface, and set the display order to alphabetical, in the template tag I use to display the categories. I can also use multiple underscores to extend this “effect”. Ugly, but it works!

And the top 10% thing – I was about to call the category “Cool Tips”, and then I started thinking about alternate names. I repeated “tip” a bunch of times in my mind, and up popped “tip of the iceberg”, from no where. Iceberg are cool, and only the top 10% of icebergs (the tip) shows above the water. All said, I liked the idea, and since I couldn’t call the category “tip of the iceberg” as it sounds stupid and cliched, I picked “Ten Percent for the Day”.

5 Comments

  1. AHHHHHHHH !!!!!!!!!!!!!!!!
    I would never have got that one !

    And using spaces before the names is cool too.

    Comment by Podz — 3/9/2005 @ 6:59 am

  2. How about, oh, using the new functions that allow you to get links by category ID? You’d have to invoke the function for every category, but it would be worth it to not have to bugger with the category names.

    I’ll post code examples if desired.

    Comment by Geof F. Morris — 3/9/2005 @ 9:48 am

  3. Huh, I’ve been using the “Rating” to order it how I want. Heh heh, ten percent… pretty clever.

    Comment by Happy Steve — 3/9/2005 @ 10:49 am

  4. Geof,
    For someone with more than 30 categories, it might be a pain to have so many tags to build a category list. This tip was from the ugly-but-works quarter. The underscore doesn’t show anywhere, by the way.

    Comment by Carthik — 3/9/2005 @ 11:27 am

  5. Yeah, but if you’re wanting to only pull out one or two cats, you could do it pretty easily. Your observation’s duly noted and appreciated. :)

    Comment by Geof F. Morris — 3/10/2005 @ 9:33 pm

RSS feed for comments on this post.

Sorry, the comment form is closed at this time.

 

Powered by WordPress

eXTReMe Tracker