wpseek.com
WordPress开发者和主题制作者的搜索引擎



block_core_breadcrumbs_create_item › WordPress Function

Since7.0.0
已弃用n/a
› block_core_breadcrumbs_create_item ( $text, $is_paged = false )
参数: (2)
  • (string) $text The text content.
    Required: Yes
  • (bool) $is_paged Whether we're on a paginated view.
    Required: No
    默认: false
返回:
  • (array) The breadcrumb item data.
定义在:
文档:

Creates a breadcrumb item that's either a link or current page item.

When paginated (is_paged is true), creates a link to page 1. Otherwise, creates a span marked as the current page.


源码

function block_core_breadcrumbs_create_item( $text, $is_paged = false ) {
	$item = array( 'label' => $text );
	if ( $is_paged ) {
		$item['url'] = get_pagenum_link( 1 );
	}
	return $item;
}