Yoast\WP\SEO\Llms_Txt\Infrastructure\Content
Manual_Post_Collection::get_posts
The post method to get all relevant content type entries
Метод класса: Manual_Post_Collection{}
Хуков нет.
Возвращает
Массив
Использование
$Manual_Post_Collection = new Manual_Post_Collection(); $Manual_Post_Collection->get_posts(): array;
Код Manual_Post_Collection::get_posts() Manual Post Collection::get posts Yoast 27.8
public function get_posts(): array {
$posts = [];
$pages = [
'about_us_page',
'contact_page',
'terms_page',
'privacy_policy_page',
'shop_page',
];
foreach ( $pages as $page ) {
$page_id = $this->options_helper->get( $page );
if ( ! empty( $page_id ) ) {
$post = $this->get_content_type_entry( $page_id );
if ( $post !== null ) {
$posts[] = $post;
}
else {
$this->options_helper->set( $page, 0 );
}
}
}
$other_pages = $this->options_helper->get( 'other_included_pages' );
$filtered_pages = [];
if ( ! empty( $other_pages ) ) {
foreach ( $other_pages as $page_id ) {
$post = $this->get_content_type_entry( $page_id );
if ( $post !== null ) {
$posts[] = $post;
$filtered_pages[] = $page_id;
}
}
if ( \count( $filtered_pages ) !== \count( $other_pages ) ) {
$this->options_helper->set( 'other_included_pages', $filtered_pages );
}
}
return $posts;
}