get_links_list

Output entire list of links by category.

Description

get_links_list( (string) $order = 'name' ); 

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

Parameters (1)

0. $order — Optional. (string) => 'name'
Sort link categories by name or id

Usage

  1. if ( !function_exists( 'get_links_list' ) ) { 
  2. require_once ABSPATH . WPINC . '/deprecated.php'; 
  3.  
  4. // Sort link categories by 'name' or 'id' 
  5. $order = 'name'; 
  6.  
  7. // NOTICE! Understand what this does before running. 
  8. $result = get_links_list($order); 
  9.  

Defined (1)

The function is defined in the following location(s).

/wp-includes/deprecated.php  
  1. function get_links_list($order = 'name') { 
  2. _deprecated_function( __FUNCTION__, '2.1.0', 'wp_list_bookmarks()' ); 
  3.  
  4. $order = strtolower($order); 
  5.  
  6. // Handle link category sorting 
  7. $direction = 'ASC'; 
  8. if ( '_' == substr($order, 0, 1) ) { 
  9. $direction = 'DESC'; 
  10. $order = substr($order, 1); 
  11.  
  12. if ( !isset($direction) ) 
  13. $direction = ''; 
  14.  
  15. $cats = get_categories(array('type' => 'link', 'orderby' => $order, 'order' => $direction, 'hierarchical' => 0)); 
  16.  
  17. // Display each category 
  18. if ( $cats ) { 
  19. foreach ( (array) $cats as $cat ) { 
  20. // Handle each category. 
  21.  
  22. // Display the category name 
  23. echo ' <li id="linkcat-' . $cat->term_id . '" class="linkcat"><h2>' . apply_filters('link_category', $cat->name ) . "</h2>\n\t<ul>\n"; 
  24. // Call get_links() with all the appropriate params 
  25. get_links($cat->term_id, '<li>', "</li>", "\n", true, 'name', false); 
  26.  
  27. // Close the last category 
  28. echo "\n\t</ul>\n</li>\n";