функция Устаревший since 1.5.0

previous_post()

Устаревшее. Помечено устаревшим с версии 2.0.0.

Проверено на WordPress 6.9, обновлено Источник: WordPress Developer Resources.

Сигнатура

previous_post( string $format = '%', string $previous = 'previous post: ', string $title = 'yes', string $in_same_cat = 'no', int $limitprev = 1, string $excluded_categories = '' )

Описание

См. alsoprevious_post_link()

Оригинал (английский)

Параметры

$format string необязательный = '%'
Default:'%'
$previous string необязательный = 'previous post: '
Default:'previous post: '
$title string необязательный = 'yes'
Default:'yes'
$in_same_cat string необязательный = 'no'
Default:'no'
$limitprev int необязательный = 1
Default:1
$excluded_categories string необязательный = ''
Default:''

Исходный код

wp-includes/deprecated.php:137

function previous_post($format='%', $previous='previous post: ', $title='yes', $in_same_cat='no', $limitprev=1, $excluded_categories='') {

	_deprecated_function( __FUNCTION__, '2.0.0', 'previous_post_link()' );

	if ( empty($in_same_cat) || 'no' == $in_same_cat )
		$in_same_cat = false;
	else
		$in_same_cat = true;

	$post = get_previous_post($in_same_cat, $excluded_categories);

	if ( !$post )
		return;

	$string = '<a href="'.get_permalink($post->ID).'">'.$previous;
	if ( 'yes' == $title )
		/** This filter is documented in wp-includes/post-template.php */
		$string .= apply_filters('the_title', $post->post_title, $post->ID);
	$string .= '</a>';
	$format = str_replace('%', $string, $format);
	echo $format;
}

История изменений

ВерсияОписание
2.0.0 Deprecated. Use previous_post_link()
1.5.0 Introduced.

Что будем искать? Например,Продвижение

Этот сайт использует куки-файлы. Оставаясь на сайте, Вы соглашаетесь на их использование. Для получения дополнительной информации, пожалуйста, ознакомьтесь с политикой в отношении персональных данных.