функция
Устаревший since 2.8.0
get_boundary_post_rel_link()
Устаревшее.
Помечено устаревшим с версии 3.3.0.
Проверено на WordPress 6.9, обновлено Источник: WordPress Developer Resources.
Сигнатура
get_boundary_post_rel_link( string $title = '%title', bool $in_same_cat = false, string $excluded_categories = '', bool $start = true ): string
Описание
Может быть реляционной ссылкой на первую или последнюю запись.
Оригинал (английский)
Can either be start or end post relational link.
Параметры
$title
string
необязательный
= '%title'
Формат заголовка ссылки. По умолчанию '%title'.
$in_same_cat
bool
необязательный
= false
Должна ли ссылка вести на запись из той же категории.
$excluded_categories
string
необязательный
= ''
ID исключаемых категорий.
$start
bool
необязательный
= true
Отображать ли ссылку на первую или последнюю запись.
Возвращаемое значение
string
Исходный код
wp-includes/deprecated.php:2690
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);
/** This filter is documented in wp-includes/post-template.php */
$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 );
}
История изменений
| Версия | Описание |
|---|---|
| 3.3.0 | Устаревший. |
| 2.8.0 | Introduced. |

