获取边界关系链接。
原型
get_boundary_post_rel_link( string $title = '%title', bool $in_same_cat = false, string $excluded_categories = '', bool $start = true )
描述
可以是关系链接的开始或结束。
参数
$title
(string)
(Optional)
链接标题格式。
$in_same_cat
(bool)
(Optional)
链接是否应该属于同一类别。
$excluded_categories
(string)
(Optional)
排除的类别ID。
$start
(bool)
(Optional)
是否显示第一个或最后一个帖子的链接。
返回值
(string)
源文件
路径:wp-includes/deprecated.php
<?php
...
function get_boundary_post_rel_link($title = '%title', $in_same_cat = false, $excluded_categories = '', $start = true) {
_deprecated_function( __FUNCTION__, '3.3.0' );
$posts = get_boundary_post($in_same_cat, $excluded_categories, $start);
// If there is no post stop.
if ( empty($posts) )
return;
// Even though we limited get_posts to return only 1 item it still returns an array of objects.
$post = $posts[0];
if ( empty($post->post_title) )
$post->post_title = $start ? __('First Post') : __('Last Post');
$date = mysql2date(get_option('date_format'), $post->post_date);
$title = str_replace('%title', $post->post_title, $title);
$title = str_replace('%date', $date, $title);
$title = apply_filters('the_title', $title, $post->ID);
$link = $start ? "<link rel='start' title='" : "<link rel='end' title='";
$link .= esc_attr($title);
$link .= "' href='" . get_permalink($post) . "' />n";
$boundary = $start ? 'start' : 'end';
return apply_filters( "{$boundary}_post_rel_link", $link );
}
...
?>
其他
英文文档:https://developer.wordpress.org/reference/functions/get_boundary_post_rel_link/