Yoast\WP\SEO\Generators\Schema\Third_Party
Events_Calendar_Schema::generate() public Yoast 1.0
Adds our Event piece of the graph. Partially lifted from the 'Tribe__JSON_LD__Abstract' class.
{} Это метод класса: Events_Calendar_Schema{}
Хуков нет.
Возвращает
Массив. $graph Event Schema markup
Использование
$Events_Calendar_Schema = new Events_Calendar_Schema(); $Events_Calendar_Schema->generate();
Заметки
Код Events_Calendar_Schema::generate() Events Calendar Schema::generate Yoast 15.6.2
public function generate() {
$posts = [];
if ( \is_singular( 'tribe_events' ) ) {
global $post;
$posts[] = $post;
}
elseif ( \tribe_is_month() ) {
$posts = $this->get_month_events();
}
$tribe_data = $this->get_tribe_schema( $posts );
$tribe_data = $this->transform_tribe_schema( $tribe_data );
$data = [];
foreach ( $tribe_data as $t ) {
// Cast the schema object as array, the Yoast Class can't handle objects.
$data[] = (array) $t;
}
// If the resulting array only has one entry, print it directly.
if ( \count( $data ) === 1 ) {
$data = $data[0];
$data['mainEntityOfPage'] = [ '@id' => $this->context->canonical . Schema_IDs::WEBPAGE_HASH ];
}
elseif ( \count( $data ) === 0 ) {
$data = false;
}
return $data;
}