Warning: This function has been deprecated. Use wp_list_bookmarks() instead.

get_links_list() WordPress Function

This function returns an array of links to WordPress posts. The array is keyed by the post ID and contains the permalink and post title.

get_links_list( string $order = 'name' ) #

Output entire list of links by category.


Description

Output a list of all links, listed by category, using the settings in $wpdb->linkcategories and output it as a nested HTML unordered list.

Top ↑

See also


Top ↑

Parameters

$order

(string)(Optional)Sort link categories by 'name' or 'id'

Default value: 'name'


Top ↑

Source

File: wp-includes/deprecated.php

function get_links_list($order = 'name') {
	_deprecated_function( __FUNCTION__, '2.1.0', 'wp_list_bookmarks()' );

	$order = strtolower($order);

	// Handle link category sorting.
	$direction = 'ASC';
	if ( '_' == substr($order,0,1) ) {
		$direction = 'DESC';
		$order = substr($order,1);
	}

	if ( !isset($direction) )
		$direction = '';

	$cats = get_categories(array('type' => 'link', 'orderby' => $order, 'order' => $direction, 'hierarchical' => 0));

	// Display each category.
	if ( $cats ) {
		foreach ( (array) $cats as $cat ) {
			// Handle each category.

			// Display the category name.
			echo '  <li id="linkcat-' . $cat->term_id . '" class="linkcat"><h2>' . apply_filters('link_category', $cat->name ) . "</h2>\n\t<ul>\n";
			// Call get_links() with all the appropriate params.
			get_links($cat->term_id, '<li>', "</li>", "\n", true, 'name', false);

			// Close the last category.
			echo "\n\t</ul>\n</li>\n";
		}
	}
}


Top ↑

Changelog

Changelog
VersionDescription
2.1.0Use wp_list_bookmarks()
1.0.1Introduced.

The content displayed on this page has been created in part by processing WordPress source code files which are made available under the GPLv2 (or a later version) license by theĀ Free Software Foundation. In addition to this, the content includes user-written examples and information. All material is subject to review and curation by the WPPaste.com community.

Show More