Adds header block template as an option to customize header. #59.
This commit is contained in:
parent
88e17c2910
commit
5e35c7ec60
|
@ -171,11 +171,18 @@
|
||||||
margin-left: 0 !important;
|
margin-left: 0 !important;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Search block with some details */
|
/* Search and navigation block with some details */
|
||||||
.wp-block-search__label {
|
.wp-block-search__label {
|
||||||
font-weight: bold;
|
font-weight: bold;
|
||||||
font-size: 1em;
|
font-size: 1em;
|
||||||
}
|
}
|
||||||
.wp-block-search__inside-wrapper .wp-block-search__button {
|
.wp-block-search__inside-wrapper .wp-block-search__button {
|
||||||
margin-left: 0;
|
margin-left: 0;
|
||||||
|
padding: 0.125rem;
|
||||||
|
}
|
||||||
|
.wp-block-navigation .wp-block-navigation-item__label {
|
||||||
|
white-space: nowrap;
|
||||||
|
}
|
||||||
|
.wp-block-navigation__responsive-close {
|
||||||
|
margin-right: 0px;
|
||||||
}
|
}
|
|
@ -18,6 +18,21 @@ if ( !function_exists('tainacan_interface_customize_register_header_general') )
|
||||||
'panel' => 'tainacan_header_settings'
|
'panel' => 'tainacan_header_settings'
|
||||||
));
|
));
|
||||||
|
|
||||||
|
// Use block Template Parts for Header
|
||||||
|
$wp_customize->add_setting( 'tainacan_use_block_template_parts_on_header', 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_header', array(
|
||||||
|
'type' => 'checkbox',
|
||||||
|
'settings' => 'tainacan_use_block_template_parts_on_header',
|
||||||
|
'section' => 'tainacan_header_general',
|
||||||
|
'label' => __( 'Use block template parts to configure header', 'tainacan-interface' ),
|
||||||
|
'description' => __( 'Build your own header using the block editor in the menu Appearance -> Template Parts -> Header. If enabled, the options below do not apply.', 'tainacan-interface')
|
||||||
|
) );
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Adds options to align header elements
|
* Adds options to align header elements
|
||||||
*/
|
*/
|
||||||
|
|
|
@ -124,6 +124,7 @@ function tainacan_block_patterns_init() {
|
||||||
'categories' => array('tainacan-interface')
|
'categories' => array('tainacan-interface')
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
|
|
||||||
register_block_pattern(
|
register_block_pattern(
|
||||||
'tainacan-interface/tainacan-highlight-section-pattern-alt',
|
'tainacan-interface/tainacan-highlight-section-pattern-alt',
|
||||||
array(
|
array(
|
||||||
|
@ -216,6 +217,24 @@ function tainacan_block_patterns_init() {
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
|
|
||||||
|
/* Default header content */
|
||||||
|
register_block_pattern(
|
||||||
|
'tainacan-interface/tainacan-header',
|
||||||
|
array(
|
||||||
|
'title' => __( 'Tainacan header section', 'tainacan-interface' ),
|
||||||
|
'description' => _x( 'A block-based header that can be used as alterative to the default template.', 'Block pattern description', 'tainacan-interface' ),
|
||||||
|
'content' => '<!-- wp:group {"tagName":"header","style":{"border":{"bottom":{"color":"#ededed","style":"solid","width":"1px"}},"spacing":{"padding":{"top":"0.6rem","bottom":"0.6rem","right":"0vw","left":"0vw"}}},"layout":{"type":"constrained"}} -->
|
||||||
|
<header class="wp-block-group" style="border-bottom-color:#ededed;border-bottom-style:solid;border-bottom-width:1px;padding-top:0.6rem;padding-right:0vw;padding-bottom:0.6rem;padding-left:0vw"><!-- wp:group {"align":"wide","layout":{"type":"flex","flexWrap":"wrap","justifyContent":"space-between","verticalAlignment":"center"}} -->
|
||||||
|
<div class="wp-block-group alignwide"><!-- wp:site-title {"style":{"elements":{"link":{"color":{"text":"#1d1d1d"}}},"typography":{"fontSize":"1.5rem","fontStyle":"normal","fontWeight":"400"}}} /-->
|
||||||
|
|
||||||
|
<!-- wp:navigation {"ref":8332,"icon":"menu","layout":{"type":"flex","justifyContent":"right","flexWrap":"nowrap"},"style":{"layout":{"selfStretch":"fill"},"spacing":{"blockGap":"var:preset|spacing|60"}},"fontSize":"small"} /--></div>
|
||||||
|
<!-- /wp:group --></header>
|
||||||
|
<!-- /wp:group -->',
|
||||||
|
'categories' => array('tainacan-interface'),
|
||||||
|
'inserter' => false
|
||||||
|
)
|
||||||
|
);
|
||||||
|
|
||||||
/* Default footer content */
|
/* Default footer content */
|
||||||
register_block_pattern(
|
register_block_pattern(
|
||||||
'tainacan-interface/tainacan-footer',
|
'tainacan-interface/tainacan-footer',
|
||||||
|
@ -265,7 +284,8 @@ function tainacan_block_patterns_init() {
|
||||||
<!-- /wp:group --></div>
|
<!-- /wp:group --></div>
|
||||||
<!-- /wp:group --></footer>
|
<!-- /wp:group --></footer>
|
||||||
<!-- /wp:group -->',
|
<!-- /wp:group -->',
|
||||||
'categories' => array('tainacan-interface')
|
'categories' => array('tainacan-interface'),
|
||||||
|
'inserter' => false
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
|
@ -17,6 +17,8 @@
|
||||||
} else {
|
} else {
|
||||||
do_action( 'wp_body_open' );
|
do_action( 'wp_body_open' );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if ( !get_theme_mod('tainacan_use_block_template_parts_on_header', false) ) :
|
||||||
?>
|
?>
|
||||||
<nav
|
<nav
|
||||||
style="min-height: <?php echo esc_attr(get_theme_mod('tainacan_header_min_height', 50)) ?>px;"
|
style="min-height: <?php echo esc_attr(get_theme_mod('tainacan_header_min_height', 50)) ?>px;"
|
||||||
|
@ -66,6 +68,8 @@
|
||||||
</div>
|
</div>
|
||||||
</nav>
|
</nav>
|
||||||
|
|
||||||
|
<?php else: block_template_part( 'header' ); endif; ?>
|
||||||
|
|
||||||
<a href="javascript:" id="return-to-top" style="<?php echo (get_theme_mod( 'tainacan_footer_color', 'dark' ) == 'colored' ? 'background-color: #2c2d2d;' : '') ?>"><i class="tainacan-icon tainacan-icon-arrowup"></i></a>
|
<a href="javascript:" id="return-to-top" style="<?php echo (get_theme_mod( 'tainacan_footer_color', 'dark' ) == 'colored' ? 'background-color: #2c2d2d;' : '') ?>"><i class="tainacan-icon tainacan-icon-arrowup"></i></a>
|
||||||
|
|
||||||
<?php if ( !is_page_template( 'page-templates/landing.php' ) ) : ?>
|
<?php if ( !is_page_template( 'page-templates/landing.php' ) ) : ?>
|
||||||
|
|
|
@ -0,0 +1 @@
|
||||||
|
<!-- wp:pattern {"slug":"tainacan-interface/tainacan-header"} /-->
|
File diff suppressed because one or more lines are too long
Loading…
Reference in New Issue