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,64 +1,69 @@
<?php if ( ! is_404() ) : ?> <?php if ( ! is_404() ) :
<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;"> if ( !get_theme_mod('tainacan_use_block_template_parts_on_footer', false) ) : ?>
<?php if ( is_active_sidebar( 'tainacan-sidebar-footer' ) ) { ?> <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;">
<div class="row tainacan-footer-widgets-area"> <?php if ( is_active_sidebar( 'tainacan-sidebar-footer' ) ) { ?>
<ul class="col-12 col-lg pt-3 pb-3 pl-0 pr-0 d-lg-flex flex-wrap justify-content-xs-center mb-md-0"> <div class="row tainacan-footer-widgets-area">
<?php dynamic_sidebar( 'tainacan-sidebar-footer' ); ?> <ul class="col-12 col-lg pt-3 pb-3 pl-0 pr-0 d-lg-flex flex-wrap justify-content-xs-center mb-md-0">
</ul> <?php dynamic_sidebar( 'tainacan-sidebar-footer' ); ?>
</div> </ul>
<?php } ?> </div>
<hr class="tainacan-footer-area-separator"/> <?php } ?>
<div class="row pt-3 pb-4 pl-0 pr-0 tainacan-footer-info"> <hr class="tainacan-footer-area-separator"/>
<div class="col text-white font-weight-normal"> <div class="row pt-3 pb-4 pl-0 pr-0 tainacan-footer-info">
<p class="tainacan-footer-info--blog"> <div class="col text-white font-weight-normal">
<?php echo bloginfo( 'title' ); <p class="tainacan-footer-info--blog">
if ( ! wp_is_mobile() ) { <?php echo bloginfo( 'title' );
echo '<br>'; if ( ! wp_is_mobile() ) {
} else { echo '<br>';
echo '</p><p>'; } else {
} echo '</p><p>';
if ( get_theme_mod( 'tainacan_blogaddress' ) ) { }
echo wp_filter_nohtml_kses( get_theme_mod( 'tainacan_blogaddress', '' ) ); if ( get_theme_mod( 'tainacan_blogaddress' ) ) {
} ?> echo wp_filter_nohtml_kses( get_theme_mod( 'tainacan_blogaddress', '' ) );
<?php if ( get_theme_mod( 'tainacan_blogemail' ) ) { } ?>
printf( __( 'E-mail: %s', 'tainacan-interface' ), sanitize_email( get_theme_mod( 'tainacan_blogemail', '' ) ) ); <?php if ( get_theme_mod( 'tainacan_blogemail' ) ) {
} printf( __( 'E-mail: %s', 'tainacan-interface' ), sanitize_email( get_theme_mod( 'tainacan_blogemail', '' ) ) );
if ( get_theme_mod( 'tainacan_blogemail' ) && get_theme_mod( 'tainacan_blogphone' ) ) { }
if ( wp_is_mobile() ) : if ( get_theme_mod( 'tainacan_blogemail' ) && get_theme_mod( 'tainacan_blogphone' ) ) {
echo '<br>'; if ( wp_is_mobile() ) :
else : echo '<br>';
echo ' - '; else :
endif; echo ' - ';
} endif;
if ( get_theme_mod( 'tainacan_blogphone' ) ) { }
printf( __( 'Telephone: %s', 'tainacan-interface' ), wp_filter_nohtml_kses( get_theme_mod( 'tainacan_blogphone', '' ) ) ); if ( get_theme_mod( 'tainacan_blogphone' ) ) {
} ?> printf( __( 'Telephone: %s', 'tainacan-interface' ), wp_filter_nohtml_kses( get_theme_mod( 'tainacan_blogphone', '' ) ) );
</p> } ?>
</div> </p>
<?php if (get_theme_mod('tainacan_display_footer_logo', true) == true) : ?> </div>
<div class="col-auto pr-0 pr-md-3 d-none d-md-block align-self-md-top"> <?php if (get_theme_mod('tainacan_display_footer_logo', true) == true) : ?>
<?php <div class="col-auto pr-0 pr-md-3 d-none d-md-block align-self-md-top">
<?php
if ( get_theme_mod( 'tainacan_footer_logo' ) ) {
$footerImage = esc_attr( get_theme_mod( 'tainacan_footer_logo' ) ); if ( get_theme_mod( 'tainacan_footer_logo' ) ) {
} else { $footerImage = esc_attr( get_theme_mod( 'tainacan_footer_logo' ) );
$footerImage = get_theme_mod( 'tainacan_footer_color', 'dark' ) == 'light' ? esc_url( get_template_directory_uri() ) . '/assets/images/logo.svg' : esc_url( get_template_directory_uri() ) . '/assets/images/logo-footer.svg'; } else {
} $footerImage = get_theme_mod( 'tainacan_footer_color', 'dark' ) == 'light' ? esc_url( get_template_directory_uri() ) . '/assets/images/logo.svg' : esc_url( get_template_directory_uri() ) . '/assets/images/logo-footer.svg';
?> }
<a href="<?php echo esc_url(get_theme_mod('tainacan_footer_logo_link', 'https://tainacan.org')) ?>"> ?>
<img src="<?php echo $footerImage; ?>" class="tainacan-footer-info--logo" > <a href="<?php echo esc_url(get_theme_mod('tainacan_footer_logo_link', 'https://tainacan.org')) ?>">
</a> <img src="<?php echo $footerImage; ?>" class="tainacan-footer-info--logo" >
</a>
</div>
<?php endif; ?>
<div class="col-12 tainacan-powered">
<span>
<?php if ( true == get_theme_mod( 'tainacan_display_powered', false ) ) {
/* translators: 1: WordPress; 2: Tainacan*/
printf( __( 'Proudly powered by %1$s and %2$s.', 'tainacan-interface' ), '<a href="https://wordpress.org/">WordPress</a>', '<a href="https://tainacan.org/">Tainacan</a>' ); } ?>
</span>
</div> </div>
<?php endif; ?>
<div class="col-12 tainacan-powered">
<span>
<?php if ( true == get_theme_mod( 'tainacan_display_powered', false ) ) {
/* translators: 1: WordPress; 2: Tainacan*/
printf( __( 'Proudly powered by %1$s and %2$s.', 'tainacan-interface' ), '<a href="https://wordpress.org/">WordPress</a>', '<a href="https://tainacan.org/">Tainacan</a>' ); } ?>
</span>
</div> </div>
</div> </footer>
</footer> <?php else:
block_template_part( 'footer' );
endif;
?>
<?php endif; ?> <?php endif; ?>
<?php wp_footer(); ?> <?php wp_footer(); ?>
</body> </body>

View File

@ -194,6 +194,7 @@ if ( ! function_exists( 'tainacan_setup' ) ) {
add_theme_support( 'appearance-tools' ); add_theme_support( 'appearance-tools' );
add_theme_support( 'editor-style' ); add_theme_support( 'editor-style' );
add_editor_style( 'editor-style.css' ); add_editor_style( 'editor-style.css' );
add_theme_support( 'block-template-parts' );
} }
} // tainacan_setup check } // tainacan_setup check

View File

@ -52,6 +52,7 @@ function tainacan_customize_register( $wp_customize ) {
} }
} }
} }
add_action( 'customize_register', 'tainacan_customize_register', 11 ); 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' ), '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 ); 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 -->