From 08d2987640be4ad4f22039f37ca26bf01dad651c Mon Sep 17 00:00:00 2001 From: mateuswetah Date: Fri, 17 Feb 2023 18:08:39 -0300 Subject: [PATCH] Begins implementation of block template parts for tainacan interface. #59. --- src/footer.php | 123 ++++++++++++----------- src/functions.php | 1 + src/functions/customizer.php | 1 + src/functions/customizer/footer-info.php | 15 +++ src/parts/footer.html | 47 +++++++++ 5 files changed, 128 insertions(+), 59 deletions(-) create mode 100644 src/parts/footer.html diff --git a/src/footer.php b/src/footer.php index 8cfd01e..9afb92e 100644 --- a/src/footer.php +++ b/src/footer.php @@ -1,64 +1,69 @@ - - + diff --git a/src/functions.php b/src/functions.php index 4100c97..65793a9 100644 --- a/src/functions.php +++ b/src/functions.php @@ -194,6 +194,7 @@ if ( ! function_exists( 'tainacan_setup' ) ) { add_theme_support( 'appearance-tools' ); add_theme_support( 'editor-style' ); add_editor_style( 'editor-style.css' ); + add_theme_support( 'block-template-parts' ); } } // tainacan_setup check diff --git a/src/functions/customizer.php b/src/functions/customizer.php index aa58ada..17682ec 100644 --- a/src/functions/customizer.php +++ b/src/functions/customizer.php @@ -52,6 +52,7 @@ function tainacan_customize_register( $wp_customize ) { } } + } add_action( 'customize_register', 'tainacan_customize_register', 11 ); diff --git a/src/functions/customizer/footer-info.php b/src/functions/customizer/footer-info.php index 538a5a5..535c39e 100644 --- a/src/functions/customizer/footer-info.php +++ b/src/functions/customizer/footer-info.php @@ -130,6 +130,21 @@ if ( !function_exists('tainacan_interface_customize_register_footer_info') ) { 'description' => __( 'This checkbox shows the "Proudly Powered by WordPress and Tainacan" sentence.', 'tainacan-interface' ), ) ); + // Use block Template Parts for Footer + $wp_customize->add_setting( 'tainacan_use_block_template_parts_on_footer', array( + 'type' => 'theme_mod', + 'default' => false, + 'capability' => 'edit_theme_options', + 'sanitize_callback' => 'tainacan_callback_sanitize_checkbox', + ) ); + $wp_customize->add_control( 'tainacan_use_block_template_parts_on_footer', array( + 'type' => 'checkbox', + 'settings' => 'tainacan_use_block_template_parts_on_footer', + 'section' => 'tainacan_interface_footer_info', + 'label' => __( 'Use block template parts to configure footer', 'tainacan-interface' ), + 'description' => __( 'Build your own footer using the block editor in the menu Appearance -> Template Parts -> Footer.', 'tainacan-interface') + ) ); + } add_action( 'customize_register', 'tainacan_interface_customize_register_footer_info', 11 ); diff --git a/src/parts/footer.html b/src/parts/footer.html new file mode 100644 index 0000000..76c201d --- /dev/null +++ b/src/parts/footer.html @@ -0,0 +1,47 @@ + + + \ No newline at end of file