Yoast\WP\SEO\Builders
Indexable_Post_Builder::get_number_of_pages_for_post()
Gets the number of pages for a post.
Метод класса: Indexable_Post_Builder{}
Хуков нет.
Возвращает
int|null
. The number of pages or null if the post isn't paginated.
Использование
// protected - в коде основоного (родительского) или дочернего класса $result = $this->get_number_of_pages_for_post( $post );
- $post(объект) (обязательный)
- The post object.
Код Indexable_Post_Builder::get_number_of_pages_for_post() Indexable Post Builder::get number of pages for post Yoast 23.7
protected function get_number_of_pages_for_post( $post ) { $number_of_pages = ( \substr_count( $post->post_content, '<!--nextpage-->' ) + 1 ); if ( $number_of_pages <= 1 ) { return null; } return $number_of_pages; }