{"id":38,"date":"2003-08-26T21:54:28","date_gmt":"2003-08-26T21:54:28","guid":{"rendered":"http:\/\/wordpress.org\/development\/2003\/08\/new-getlinkslist-function\/"},"modified":"2021-06-04T11:58:05","modified_gmt":"2021-06-04T11:58:05","slug":"new-getlinkslist-function","status":"publish","type":"post","link":"https:\/\/wordpress.org\/news\/2003\/08\/new-getlinkslist-function\/","title":{"rendered":"New get_links_list() function"},"content":{"rendered":"

There is also a new function called get_links_list() but I’ll let Dougal explain that.<\/p><\/blockquote>\n

\nOh, sure, put me on the spot. \ud83d\ude42\n<\/p>\n


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

\nYou can see it in action on my in-testing version of my blog<\/a>. 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:\n<\/p>\n


\n<?php
\nget_links_list('id');
\n?>
\n<\/code><\/p>\n

\nI’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.\n<\/p>\n

\nThis function is hardcoded to generate an HTML unordered list (<ul \/> )<\/strong> 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.<\/p>\n","protected":false},"excerpt":{"rendered":"

There is also a new function called get_links_list() but I’ll let Dougal explain that. Oh, sure, put me on the spot. \ud83d\ude42 \/* * 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 * […]<\/p>\n","protected":false},"author":5,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"episode_type":"","audio_file":"","cover_image":"","cover_image_id":"","duration":"","filesize":"","date_recorded":"","explicit":"","block":"","filesize_raw":"","jetpack_post_was_ever_published":false,"_jetpack_newsletter_access":"","_jetpack_dont_email_post_to_subs":false,"_jetpack_newsletter_tier_id":0,"_jetpack_memberships_contains_paywalled_content":false,"_jetpack_memberships_contains_paid_content":false,"footnotes":""},"categories":[5],"tags":[],"class_list":["post-38","post","type-post","status-publish","format-standard","hentry","category-development"],"jetpack_featured_media_url":"","jetpack_shortlink":"https:\/\/wp.me\/pZhYe-C","jetpack_sharing_enabled":true,"_links":{"self":[{"href":"https:\/\/wordpress.org\/news\/wp-json\/wp\/v2\/posts\/38","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/wordpress.org\/news\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/wordpress.org\/news\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/wordpress.org\/news\/wp-json\/wp\/v2\/users\/5"}],"replies":[{"embeddable":true,"href":"https:\/\/wordpress.org\/news\/wp-json\/wp\/v2\/comments?post=38"}],"version-history":[{"count":2,"href":"https:\/\/wordpress.org\/news\/wp-json\/wp\/v2\/posts\/38\/revisions"}],"predecessor-version":[{"id":10501,"href":"https:\/\/wordpress.org\/news\/wp-json\/wp\/v2\/posts\/38\/revisions\/10501"}],"wp:attachment":[{"href":"https:\/\/wordpress.org\/news\/wp-json\/wp\/v2\/media?parent=38"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/wordpress.org\/news\/wp-json\/wp\/v2\/categories?post=38"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/wordpress.org\/news\/wp-json\/wp\/v2\/tags?post=38"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}