get_links_list ( $order = 'name' )
- 参数
-
-
(string)
$order
Sort link categories by ‘name’ or ‘id’- Required: 否
- Default: ‘name’
-
(string)
- 相关
-
- wp_list_bookmarks()
- 定义位置
-
-
wp-includes/deprecated.php
, line 1038
-
wp-includes/deprecated.php
- 引入
- 1.0.1
- 弃用
- 2.1.0
按类别输出整个链接列表。
使用$wpdb->linkcategories中的设置,按类别输出所有链接的列表,并作为嵌套的HTML无序列表输出。
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 '
‘ . apply_filters(‘link_category’, $cat->name ) . “
nt
- n”;
- ‘, “
// Call get_links() with all the appropriate params.
get_links($cat->term_id, ‘
“, “n”, true, ‘name’, false);
// Close the last category.
echo “nt
n
n”;
}
}
}
声明:本站所有文章,如无特殊说明或标注,均为本站原创发布。任何个人或组织,在未征得本站同意时,禁止复制、盗用、采集、发布本站内容到任何网站、书籍等各类媒体平台。如若本站内容侵犯了原著者的合法权益,可联系我们进行处理。