Yoast\WP\SEO\Generators
Open_Graph_Image_Generator::add_from_templates
Retrieves the default Open Graph image.
Метод класса: Open_Graph_Image_Generator{}
Хуков нет.
Возвращает
null. Ничего (null).
Использование
// protected - в коде основоного (родительского) или дочернего класса $result = $this->add_from_templates( $context, $image_container );
- $context(Meta_Tags_Context) (обязательный)
- The context.
- $image_container(Images) (обязательный)
- The image container.
Код Open_Graph_Image_Generator::add_from_templates() Open Graph Image Generator::add from templates Yoast 26.9
protected function add_from_templates( Meta_Tags_Context $context, Images $image_container ) {
if ( $image_container->has_images() ) {
return;
}
if ( $context->presentation->open_graph_image_id ) {
$image_container->add_image_by_id( $context->presentation->open_graph_image_id );
return;
}
if ( $context->presentation->open_graph_image ) {
$image_container->add_image_by_url( $context->presentation->open_graph_image );
}
}