Yoast\WP\SEO\Presentations
Indexable_Post_Type_Presentation::generate_rel_prev() public Yoast 1.0
Generates the rel prev.
{} Это метод класса: Indexable_Post_Type_Presentation{}
Хуков нет.
Возвращает
Строку. The rel prev value.
Использование
$Indexable_Post_Type_Presentation = new Indexable_Post_Type_Presentation(); $Indexable_Post_Type_Presentation->generate_rel_prev();
Код Indexable_Post_Type_Presentation::generate_rel_prev() Indexable Post Type Presentation::generate rel prev Yoast 15.6.2
public function generate_rel_prev() {
if ( $this->model->number_of_pages === null ) {
return '';
}
if ( $this->pagination->is_rel_adjacent_disabled() ) {
return '';
}
$current_page = \max( 1, $this->pagination->get_current_post_page_number() );
// Check if there is a previous page.
if ( $current_page < 2 ) {
return '';
}
// Check if the previous page is the first page.
if ( $current_page === 2 ) {
return $this->model->permalink;
}
return $this->get_paginated_url( $this->model->permalink, ( $current_page - 1 ) );
}