| 1 |
<?php |
| 2 |
|
| 3 |
$faqs = betterdocs()->query->get_faq_by_term( $term->term_id ); |
| 4 |
|
| 5 |
if ( $faqs->have_posts() ) { |
| 6 |
echo '<ul class="betterdocs-faq-list">'; |
| 7 |
|
| 8 |
$faq_markup = ''; |
| 9 |
while ( $faqs->have_posts() ): $faqs->the_post(); |
| 10 |
echo '<li>'; |
| 11 |
echo '<div class="betterdocs-faq-group">'; |
| 12 |
$view_object->get( 'shortcode-parts/faq-title' ); |
| 13 |
$view_object->get( 'shortcode-parts/faq-content' ); |
| 14 |
echo '</div>'; |
| 15 |
echo '</li>'; |
| 16 |
|
| 17 |
if ( $faq_schema ) { |
| 18 |
$faq_json = [ |
| 19 |
'@type' => 'Question', |
| 20 |
'name' => get_the_title(), |
| 21 |
'acceptedAnswer' => [ |
| 22 |
'@type' => 'Answer', |
| 23 |
'text' => get_the_content() |
| 24 |
] |
| 25 |
]; |
| 26 |
$GLOBALS['betterdocs_faq_schema_main_entity'][] = $faq_json; |
| 27 |
} |
| 28 |
endwhile; |
| 29 |
wp_reset_postdata(); |
| 30 |
wp_reset_query(); |
| 31 |
echo $faq_markup; |
| 32 |
echo '</ul>'; |
| 33 |
} else { |
| 34 |
echo '<p>' . __( 'Sorry, no FAQ matched your criteria.', 'betterdocs' ) . '</p>'; |
| 35 |
} |
| 36 |
|