diff --git a/readme.txt b/readme.txt
index 91f407d00..63005d165 100644
--- a/readme.txt
+++ b/readme.txt
@@ -65,6 +65,7 @@ e.g.
== Changelog ==
+[ Add Function ][ FAQ2 ] Add an accordion default option on a per-block.
[ Specification Change ] Disable HTML editing for blocks with inner blocks, as the blocks are broken.
[ Bug fix ][ Dynamic Text (Pro) ] Fix php warning that brought by can't get post type name on search result page.
[ Bug fix ][ Dynamic Text (Pro) ] Fix php warning that brought by can't get ancestor page on search result page.
diff --git a/src/admin/new-faq.js b/src/admin/new-faq.js
index 8a7956f9c..3603bc9c8 100644
--- a/src/admin/new-faq.js
+++ b/src/admin/new-faq.js
@@ -19,6 +19,12 @@ export default function AdminNewFaq() {
{__('FAQ Block Setting', 'vk-blocks-pro')}
+
+ {__(
+ 'Please specify a common accordion setting to be used in the FAQ block.',
+ 'vk-blocks-pro'
+ )}
+
VK Blocks',
- 'vk-blocks-pro'
- );
- } else {
- massage = __(
- 'You can be collapsing this block at VK Blocks Pro',
- 'vk-blocks-pro'
- );
- }
-
return (
<>
- {massage}
+ {/* eslint-disable-next-line no-undef */}
+ {vk_blocks_check.is_pro ? (
+
+ {
+ setAttributes({
+ showContent: value,
+ });
+ }}
+ options={[
+ {
+ label: __(
+ 'Use common settings',
+ 'vk-blocks-pro'
+ ),
+ value: 'default',
+ },
+ {
+ label: __(
+ 'Disable accordion',
+ 'vk-blocks-pro'
+ ),
+ value: 'disable',
+ },
+ {
+ label: __(
+ 'Enable accordion and default open',
+ 'vk-blocks-pro'
+ ),
+ value: 'open',
+ },
+ {
+ label: __(
+ 'Enable accordion and default close',
+ 'vk-blocks-pro'
+ ),
+ value: 'close',
+ },
+ ]}
+ />
+
+ {__(
+ '* You can change each common accordion settings from Setting > VK Blocks.',
+ 'vk-blocks-pro'
+ )}
+
+
+ ) : (
+
+ {__(
+ 'You can be collapsing this block at VK Blocks Pro',
+ 'vk-blocks-pro'
+ )}
+
+ )}
diff --git a/src/blocks/faq2/index.php b/src/blocks/faq2/index.php
index e7b5b8a1f..c234f615f 100644
--- a/src/blocks/faq2/index.php
+++ b/src/blocks/faq2/index.php
@@ -54,6 +54,10 @@ function vk_blocks_register_block_faq2() {
function vk_blocks_faq2_render_callback( $block_content, $block ) {
$vk_blocks_options = VK_Blocks_Options::get_options();
if ( 'vk-blocks/faq2' === $block['blockName'] ) {
+ if ( ! empty( $block['attrs']['showContent'] ) && 'default' !== $block['attrs']['showContent'] ) {
+ $vk_blocks_options['new_faq_accordion'] = $block['attrs']['showContent'];
+ }
+
if ( ! empty( $vk_blocks_options['new_faq_accordion'] ) && 'open' === $vk_blocks_options['new_faq_accordion'] ) {
$block_content = str_replace( '[accordion_trigger_switch]', 'vk_faq-accordion vk_faq-accordion-open', $block_content );
} elseif ( ! empty( $vk_blocks_options['new_faq_accordion'] ) && 'close' === $vk_blocks_options['new_faq_accordion'] ) {