Yoast\WP\SEO\Generators\Schema

FAQ::generate()publicYoast 1.0

Render a list of questions, referencing them by ID.

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

Хуков нет.

Возвращает

Массив. Our Schema graph.

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

$FAQ = new FAQ();
$FAQ->generate();

Код FAQ::generate() Yoast 22.4

public function generate() {
	$graph = [];

	$questions = [];
	foreach ( $this->context->blocks['yoast/faq-block'] as $block ) {
		if ( isset( $block['attrs']['questions'] ) ) {
			$questions = \array_merge( $questions, $block['attrs']['questions'] );
		}
	}
	foreach ( $questions as $index => $question ) {
		if ( ! isset( $question['jsonAnswer'] ) || empty( $question['jsonAnswer'] ) ) {
			continue;
		}
		$graph[] = $this->generate_question_block( $question, ( $index + 1 ) );
	}

	return $graph;
}