^ 回到顶部
  • 人生没有定律,每个人都有自己的节奏
  • 本站wordpress建站教程均通过实践后发布,希望对你有帮助
  • 希望你的坚持,都是因为热爱,而不是因为不甘心
  • 8年wordpress建站经验,5星服务品质
  • 那些不愿意让你吃亏的人,才是真正值得你深交的人,也是值得你付出时间的人
  • 阿里云2核2g仅需86元/年

wordpress函数get_links_list()用法示例

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

get_links_list( string $order = 'name' )

Output entire list of links by category.

新用户2核2g仅需86元/年    领取1153套模板    免费cdn流量包    ¥3188礼包


描述

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


参数

$order

(string)
(Optional)
Sort link categories by ‘name’ or ‘id’

Default value: ‘name’


源代码

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";
		}
	}
}

更新日志

Version 描述
2.1.0 Use wp_list_bookmarks()
1.0.1 Introduced.

相关函数

Uses

  • wp-includes/deprecated.php:
    get_links()
  • wp-includes/category.php:
    get_categories()
  • wp-includes/functions.php:
    _deprecated_function()
  • wp-includes/plugin.php:
    apply_filters()
  • wp-includes/bookmark-template.php:
    link_category

让小雨知道,这篇文章帮到了你
扫码关注微信公众号zs40086(微搜片)随时随地微信看片,抢先福利电影等你来

热门推荐

如有疑问,请前往问答中心反馈!

反馈