Add footer template pattern for tweaking it via block template. #59.

This commit is contained in:
mateuswetah 2023-04-11 11:32:58 -03:00
parent 0deff84f5d
commit 88e17c2910
5 changed files with 80 additions and 72 deletions

View File

@ -15,6 +15,13 @@ Text Domain: tainacan-interface
@import '_variables';
:where(:not(.has-link-color)) a:not(.has-link-color) {
color: var(--tainacan-interface--link-color, #298596);
&:hover{
color: var(--tainacan-interface--link-color, #298596);
}
}
body {
font-family: 'Roboto' !important;
overflow-x: hidden;
@ -39,12 +46,6 @@ body {
--wp--preset--color--lightgray: #f2f2f2;
--wp--preset--color--darkgray: #555758;
*:not(.has-link-color)>*:not(.has-link-color)>a:not(.has-link-color) {
color: var(--tainacan-interface--link-color, #298596);
&:hover{
color: var(--tainacan-interface--link-color, #298596);
}
}
&.error404 {
overflow: hidden;
}
@ -123,7 +124,7 @@ body {
}
}
.wp-block-separator {
&:not(.has-background-color) {
&:not(.has-background-color):not(.has-text-color) {
border-color: #cbcbcb;
}
width: 50%;
@ -132,7 +133,7 @@ body {
width: 100%;
}
&.is-style-dots {
&:not(.has-background-color)::before {
&:not(.has-background-color):not(.has-text-color)::before {
color: #cbcbcb;
}
&::before {

View File

@ -8,6 +8,7 @@
if ( !function_exists('tainacan_interface_customize_register_footer_info') ) {
function tainacan_interface_customize_register_footer_info( $wp_customize ) {
/**
* Add others infos in Site identity on footer
*/
@ -16,6 +17,21 @@ if ( !function_exists('tainacan_interface_customize_register_footer_info') ) {
'priority' => 170,
));
// 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. If enabled, the options below do not apply.', 'tainacan-interface')
) );
$wp_customize->add_setting( 'tainacan_blogaddress', array(
'type' => 'theme_mod',
'capability' => 'manage_options',
@ -130,22 +146,6 @@ 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 );
}

View File

@ -215,6 +215,59 @@ function tainacan_block_patterns_init() {
'categories' => array('tainacan-interface')
)
);
/* Default footer content */
register_block_pattern(
'tainacan-interface/tainacan-footer',
array(
'title' => __( 'Tainacan footer section', 'tainacan-interface' ),
'description' => _x( 'A block-based footer that can be used as alterative to the default template.', 'Block pattern description', 'tainacan-interface' ),
'content' => '<!-- wp:group {"tagName":"footer","style":{"elements":{"link":{"color":{"text":"var:preset|color|lightgray"}}},"spacing":{"padding":{"top":"3rem","right":"3rem","bottom":"3rem","left":"3rem"}},"color":{"background":"#2c2d2d"}},"textColor":"white","layout":{"type":"constrained"}} -->
<footer class="wp-block-group has-white-color has-text-color has-background has-link-color" style="background-color:#2c2d2d;padding-top:3rem;padding-right:3rem;padding-bottom:3rem;padding-left:3rem"><!-- wp:group {"align":"wide","style":{"spacing":{"blockGap":"4.2%","padding":{"right":"4.2%","left":"4.2%"}}},"layout":{"type":"flex","flexWrap":"wrap","justifyContent":"space-between","verticalAlignment":"top"}} -->
<div class="wp-block-group alignwide" style="padding-right:4.2%;padding-left:4.2%"><!-- wp:group {"style":{"elements":{"link":{"color":{"text":"var:preset|color|white"}}}},"layout":{"type":"default"}} -->
<div class="wp-block-group has-link-color"><!-- wp:heading {"level":6,"style":{"typography":{"fontSize":"1.13rem"}},"textColor":"white"} -->
<h6 class="wp-block-heading has-white-color has-text-color" style="font-size:1.13rem"><strong>' .esc_html__( 'Archive', 'tainacan-interface' ) . '</strong></h6>
<!-- /wp:heading -->
<!-- wp:archives {"style":{"spacing":{"margin":{"right":"0","left":"0","bottom":"0rem","top":"1.5rem"},"padding":{"top":"0","right":"0","bottom":"0","left":"0"}}}} /--></div>
<!-- /wp:group -->
<!-- wp:group {"layout":{"type":"default"}} -->
<div class="wp-block-group"><!-- wp:heading {"level":6,"style":{"typography":{"fontSize":"1.13rem"}},"textColor":"white"} -->
<h6 class="wp-block-heading has-white-color has-text-color" style="font-size:1.13rem"><strong>' .esc_html__( 'Latest posts', 'tainacan-interface' ) . '</strong></h6>
<!-- /wp:heading -->
<!-- wp:latest-posts {"style":{"spacing":{"margin":{"top":"1.5rem"}}}} /--></div>
<!-- /wp:group -->
<!-- wp:group {"layout":{"type":"default"}} -->
<div class="wp-block-group"><!-- wp:heading {"level":6,"style":{"typography":{"fontSize":"1.13rem"}},"textColor":"white"} -->
<h6 class="wp-block-heading has-white-color has-text-color" style="font-size:1.13rem"><strong>' .esc_html__( 'Categories', 'tainacan-interface' ) . '</strong></h6>
<!-- /wp:heading -->
<!-- wp:categories {"style":{"spacing":{"margin":{"top":"1.5rem"},"padding":{"top":"0","right":"0","bottom":"0","left":"0"}}}} /--></div>
<!-- /wp:group --></div>
<!-- /wp:group -->
<!-- wp:separator {"align":"wide","style":{"spacing":{"margin":{"top":"var:preset|spacing|60","bottom":"var:preset|spacing|60"}}},"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" style="margin-top:var(--wp--preset--spacing--60);margin-bottom:var(--wp--preset--spacing--60)"/>
<!-- /wp:separator -->
<!-- wp:group {"align":"wide","style":{"spacing":{"blockGap":"4.2%"}},"layout":{"type":"flex","flexWrap":"wrap","justifyContent":"space-between","verticalAlignment":"center"}} -->
<div class="wp-block-group alignwide"><!-- wp:group {"style":{"spacing":{"padding":{"right":"0","left":"4%"}}},"layout":{"type":"default"}} -->
<div class="wp-block-group" style="padding-right:0;padding-left:4%"><!-- wp:site-title {"style":{"typography":{"fontStyle":"normal","fontWeight":"400"},"spacing":{"margin":{"top":"var:preset|spacing|20","right":"0","bottom":"var:preset|spacing|20","left":"0"}}},"fontSize":"regular"} /--></div>
<!-- /wp:group -->
<!-- wp:group {"style":{"spacing":{"padding":{"right":"4%"}}},"layout":{"type":"default"}} -->
<div class="wp-block-group" style="padding-right:4%"><!-- wp:image {"id":11051,"width":120,"sizeSlug":"thumbnail","linkDestination":"none"} -->
<figure class="wp-block-image size-thumbnail is-resized"><img src="' . esc_url( get_template_directory_uri() ) . '/assets/images/logo-footer.svg' . '" alt="" class="wp-image-11051" width="120"/></figure>
<!-- /wp:image --></div>
<!-- /wp:group --></div>
<!-- /wp:group --></footer>
<!-- /wp:group -->',
'categories' => array('tainacan-interface')
)
);
}
}
add_action( 'init', 'tainacan_block_patterns_init' );

View File

@ -1,47 +1 @@
<!-- 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 -->
<!-- wp:pattern {"slug":"tainacan-interface/tainacan-footer"} /-->

File diff suppressed because one or more lines are too long