New get_links_list() function

There is also a new function called get_links_list() but I’ll let Dougal explain that.

Oh, sure, put me on the spot. 🙂

* function get_links_list()
* added by Dougal
* Output a list of all links, listed by category, using the
* settings in $tablelinkcategories and output it as a nested
* HTML unordered list.
* Parameters:
* order (default 'name') - Sort link categories by 'name' or 'id'
* hide_if_empty (default true) - Supress listing empty link categories

You can see it in action on my in-testing version of my blog. All the links listed in the menu between the “Links:” heading down to the calendar were generated by a single line in my template that looks like this:


I’m telling it to sort my link categories by id, rather than by name, because I entered my categories into the sytem in a particular order that I wanted to use. The links under each category are sorted according to the options set in the Link Manager’s “Manage Link Categories” section.

This function is hardcoded to generate an HTML unordered list (<ul /> ) Maybe one day we’ll make a similar function that can generate the links with some different HTML formatting. But don’t count on it.

Get the Latest Updates

WP Briefing — The WordPress Podcast

Join Josepha Haden and Matt Mullenweg to learn about where WordPress is going and how you can get involved.