函数文档

get_links_withrating()

💡 云策文档标注

概述

get_links_withrating() 是一个已弃用的 WordPress 函数,用于获取指定分类的链接并显示评分星号或字符。开发者应改用 get_bookmarks() 函数。

关键要点

  • 函数已弃用:自 WordPress 2.1.0 起,建议使用 get_bookmarks() 替代。
  • 功能:获取与分类关联的链接,支持显示评分、图像、描述等。
  • 参数:包括 $category(分类ID)、$before(链接前HTML)、$after(链接后HTML)、$orderby(排序方式)等,多数有默认值。
  • 内部调用:函数内部调用 get_links() 并传递参数,包括评分显示标志。

注意事项

由于函数已弃用,在新项目中应避免使用,以免未来版本中移除导致兼容性问题。迁移到 get_bookmarks() 时需调整代码。


📄 原文内容

Gets the links associated with category n and display rating stars/chars.

Description

See also

Parameters

$categoryintoptional
The category to use. If no category supplied, uses all.
Default 0.

Default:-1

$beforestringoptional
The HTML to output before the link. Default empty.
$afterstringoptional
The HTML to output after the link. Default <br />.
$betweenstringoptional
The HTML to output between the link/image and its description.
Not used if no image or $show_images is true. Default ‘ ‘.
$show_imagesbooloptional
Whether to show images (if defined).

Default:true

$orderbystringoptional
The order to output the links. E.g. 'id', 'name', 'url', 'description', 'rating', or 'owner'. Default 'id'.
If you start the name with an underscore, the order will be reversed.
Specifying 'rand' as the order will return links in a random order.
$show_descriptionbooloptional
Whether to show the description if show_images=false/not defined.

Default:true

$limitintoptional
Limit to X entries. If not specified, all entries are shown.

Default:-1

$show_updatedintoptional
Whether to show last updated timestamp. Default 0.

Source

function get_links_withrating($category = -1, $before = '', $after = '<br />', $between = " ", $show_images = true,
							$orderby = 'id', $show_description = true, $limit = -1, $show_updated = 0) {
	_deprecated_function( __FUNCTION__, '2.1.0', 'get_bookmarks()' );

	get_links($category, $before, $after, $between, $show_images, $orderby, $show_description, true, $limit, $show_updated);
}

Changelog

Version Description
2.1.0 Deprecated. Use get_bookmarks()
0.71 Introduced.