PluginProbe
BetterDocs – AI Documentation, Knowledge Base, MCP Server, Docs, Wikis, FAQ & Chatbot / 4.9.2
BetterDocs – AI Documentation, Knowledge Base, MCP Server, Docs, Wikis, FAQ & Chatbot v4.9.2
4.9.2 4.9.1 4.9.0 4.8.2 4.8.1 4.8.0 4.7.0 4.6.2 4.6.1 4.6.0 4.5.6 4.5.5 4.5.4 4.5.3 4.5.2 4.5.1 4.5.0 4.4.1 4.4.0 3.3.4 3.4.0 3.4.1 3.4.2 3.5.0 3.5.1 All 200 releases
← All changes | views/layouts/faq.php +22 -9 3.4.24.9.2 View file →
@@ -1,15 +1,28 @@
1 1 <?php
2 -$faq_terms = get_terms( betterdocs()->query->faq_terms_query_args() );
2 +// phpcs:disable WordPress.NamingConventions.PrefixAllGlobals.NonPrefixedVariableFound -- view template receives variables via extract(); prefixing is impractical.
3 3
4 +if ( ! defined( 'ABSPATH' ) ) {
5 + exit;
6 +}
7 +$_faq_taxonomy = isset( $shortcode_attr['faq_taxonomy'] ) ? sanitize_key( $shortcode_attr['faq_taxonomy'] ) : 'betterdocs_faq_category';
8 +$faq_terms = get_terms( betterdocs()->query->faq_terms_query_args( '', '', [], $_faq_taxonomy ) );
9 +
4 10 if ( $enable && $have_posts && ! empty( $faq_terms ) ) {
5 - $enable_faq_schema = betterdocs()->settings->get( 'enable_faq_schema' );
6 - $shortcode_attr['faq_schema'] = $enable_faq_schema;
11 + // Only use settings value if faq_schema is not already set in shortcode attributes
12 + if ( ! isset( $shortcode_attr['faq_schema'] ) ) {
13 + $enable_faq_schema = betterdocs()->settings->get( 'enable_faq_schema' );
14 + $shortcode_attr['faq_schema'] = $enable_faq_schema;
15 + }
7 16
8 - $attributes = betterdocs()->template_helper->get_html_attributes( $shortcode_attr );
17 + $attributes = betterdocs()->template_helper->get_html_attributes( $shortcode_attr );
9 18
10 - if ( $layout === 'layout-1' ) {
11 - echo do_shortcode( '[betterdocs_faq_list_modern ' . $attributes . ']' );
12 - } else if ( $layout === 'layout-2' ) {
13 - echo do_shortcode( '[betterdocs_faq_list_classic ' . $attributes . ']' );
14 - }
19 + if ( $layout === 'layout-1' ) {
20 + echo do_shortcode( '[betterdocs_faq_list_modern ' . $attributes . ']' );
21 + } elseif ( $layout === 'layout-2' ) {
22 + echo do_shortcode( '[betterdocs_faq_list_classic ' . $attributes . ']' );
23 + } elseif ( $layout === 'layout-3' ) {
24 + echo do_shortcode( '[betterdocs_faq_list_layout_3 ' . $attributes . ']' );
25 + } elseif ( $layout === 'layout-4' ) {
26 + echo do_shortcode( '[betterdocs_faq_tab ' . $attributes . ']' );
27 + }
15 28 }