Begins implementation of block template parts for tainacan interface. #59.

This commit is contained in:
mateuswetah 2023-02-17 18:08:39 -03:00
parent cec04fd51d
commit 08d2987640
5 changed files with 128 additions and 59 deletions

View File

@ -1,4 +1,5 @@
<?php if ( ! is_404() ) : ?>
<?php if ( ! is_404() ) :
if ( !get_theme_mod('tainacan_use_block_template_parts_on_footer', false) ) : ?>
<footer class="container-fluid p-4 p-sm-5 mt-5 tainacan-footer <?php echo esc_attr( ('tainacan-footer-' . get_theme_mod( 'tainacan_footer_color', 'dark' )) ) ?>" style="padding-bottom: 0 !important;">
<?php if ( is_active_sidebar( 'tainacan-sidebar-footer' ) ) { ?>
<div class="row tainacan-footer-widgets-area">
@ -59,6 +60,10 @@
</div>
</div>
</footer>
<?php else:
block_template_part( 'footer' );
endif;
?>
<?php endif; ?>
<?php wp_footer(); ?>
</body>

View File

@ -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

View File

@ -52,6 +52,7 @@ function tainacan_customize_register( $wp_customize ) {
}
}
}
add_action( 'customize_register', 'tainacan_customize_register', 11 );

View File

@ -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 );

47
src/parts/footer.html Normal file
View File

@ -0,0 +1,47 @@
<!-- wp:group {"style":{"elements":{"link":{"color":{"text":"var:preset|color|white"}}},"spacing":{"padding":{"top":"3rem","right":"0rem","bottom":"3rem","left":"0rem"}},"color":{"background":"#2c2d2d"}},"textColor":"white","layout":{"inherit":true,"type":"constrained"}} -->
<div class="wp-block-group has-white-color has-text-color has-background has-link-color" style="background-color:#2c2d2d;padding-top:3rem;padding-right:0rem;padding-bottom:3rem;padding-left:0rem">
<!-- wp:separator {"align":"wide","backgroundColor":"default","className":"is-style-wide"} -->
<hr class="wp-block-separator alignwide has-text-color has-default-color has-alpha-channel-opacity has-default-background-color has-background is-style-wide"/>
<!-- /wp:separator -->
<!-- wp:group {"style":{"spacing":{"blockGap":"4.2%"}},"layout":{"type":"flex","flexWrap":"wrap","justifyContent":"space-between","verticalAlignment":"top"}} -->
<div class="wp-block-group">
<!-- wp:group {"style":{"elements":{"link":{"color":{"text":"var:preset|color|white"}}}},"layout":{"type":"constrained"}} -->
<div class="wp-block-group has-link-color">
<!-- wp:paragraph -->
<p>
<strong>Arquivo</strong>
</p>
<!-- /wp:paragraph -->
<!-- wp:archives /-->
</div>
<!-- /wp:group -->
<!-- wp:group {"layout":{"type":"constrained"}} -->
<div class="wp-block-group">
<!-- wp:paragraph -->
<p>
<strong>Páginas</strong>
</p>
<!-- /wp:paragraph -->
<!-- wp:page-list /-->
</div>
<!-- /wp:group -->
<!-- wp:group {"layout":{"type":"constrained"}} -->
<div class="wp-block-group">
<!-- wp:paragraph -->
<p>
<strong>Categorias</strong>
</p>
<!-- /wp:paragraph -->
<!-- wp:categories /-->
</div>
<!-- /wp:group -->
</div>
<!-- /wp:group -->
</div>
<!-- /wp:group -->