Yoast\WP\SEO\Helpers

Pagination_Helper::get_current_archive_page_number()publicYoast 1.0

Returns the current page for paged archives.

Метод класса: Pagination_Helper{}

Хуков нет.

Возвращает

int. The current archive page.

Использование

$Pagination_Helper = new Pagination_Helper();
$Pagination_Helper->get_current_archive_page_number();

Код Pagination_Helper::get_current_archive_page_number() Yoast 22.1

public function get_current_archive_page_number() {
	$wp_query    = $this->wp_query_wrapper->get_main_query();
	$page_number = (int) $wp_query->get( 'paged' );
	if ( $page_number > 1 ) {
		return $page_number;
	}

	$query_loop_page_number = $this->get_page_number_from_query_loop();

	if ( $query_loop_page_number ) {
		return $query_loop_page_number;
	}
	return 0;
}