Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Try/header template part wrapped #3714

Merged
merged 6 commits into from
Apr 27, 2021
Merged
Show file tree
Hide file tree
Changes from 5 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions quadrat/404.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,11 +15,11 @@
get_header();

// the header
echo do_blocks( file_get_contents( get_stylesheet_directory() . '/templates/header.html' ) );
get_template_part( 'template-parts/header' );

echo do_blocks( file_get_contents( get_stylesheet_directory() . '/templates/404.html' ) );

// the footer
echo do_blocks( file_get_contents( get_stylesheet_directory() . '/templates/footer.html' ) );

get_footer();
get_footer();
6 changes: 6 additions & 0 deletions quadrat/assets/theme.css

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

9 changes: 9 additions & 0 deletions quadrat/child-experimental-theme.json
Original file line number Diff line number Diff line change
Expand Up @@ -154,6 +154,15 @@
"lineHeight": "var(--wp--custom--line-height--body)"
}
},
"core/site-title": {
"typography": {
"fontWeight": 800,
"fontSize": "20px"
},
"color": {
"link": "var(--wp--custom--color--primary)"
}
},
"core/button": {
"color": {
"text": "var(--wp--custom--button--color--text)",
Expand Down
6 changes: 3 additions & 3 deletions quadrat/experimental-theme.json
Original file line number Diff line number Diff line change
Expand Up @@ -416,11 +416,11 @@
},
"core/site-title": {
"typography": {
"fontSize": "60px",
"fontWeight": 700
"fontSize": "20px",
"fontWeight": 800
},
"color": {
"link": "black"
"link": "var(--wp--custom--color--primary)"
}
},
"core/navigation": {
Expand Down
35 changes: 35 additions & 0 deletions quadrat/inc/render-navigation-block.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
<?php
if ( ! function_exists( 'render_navigation_block' ) ) :

function render_navigation_block( $menu_location ) {
if ( ! has_nav_menu( $menu_location ) ) {
return;
}

$has_primary_nav_items = wp_nav_menu(
array(
'theme_location' => $menu_location,
'fallback_cb' => false,
'echo' => false,
)
);

if ( ! $has_primary_nav_items ) {
return;
}

$menu_markup = '<!-- wp:html -->';
$menu_markup .= wp_nav_menu(
pbking marked this conversation as resolved.
Show resolved Hide resolved
array(
'echo' => false,
'theme_location' => $menu_location,
'container' => '',
'items_wrap' => '%3$s',
'fallback_cb' => false,
)
);
$menu_markup .= '<!-- /wp:html -->';

return $menu_markup;
}
endif;
2 changes: 1 addition & 1 deletion quadrat/index.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
get_header();

// the header
echo do_blocks( file_get_contents( get_stylesheet_directory() . '/templates/header.html' ) );
get_template_part( 'template-parts/header' );

// the query
echo do_blocks( '<!-- wp:post-content {"layout":{"inherit":true}} /-->' );
Expand Down
7 changes: 7 additions & 0 deletions quadrat/sass/_header.scss
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
.site-header {
.wp-block-group {
display: flex;
justify-content: space-between;
align-items: center;
}
}
1 change: 1 addition & 0 deletions quadrat/sass/theme.scss
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
@import "../../blank-canvas-blocks/sass/base/breakpoints"; // Get the mobile-only media query and make it available to this theme's styles
@import "blocks/media-text";
@import "blocks/list";
@import "header";
@import "utility";
4 changes: 2 additions & 2 deletions quadrat/search.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,11 +15,11 @@
get_header();

// the header
echo do_blocks( file_get_contents( get_stylesheet_directory() . '/templates/header.html' ) );
get_template_part( 'template-parts/header' );

echo do_blocks( file_get_contents( get_stylesheet_directory() . '/templates/search.html' ) );

// the footer
echo do_blocks( file_get_contents( get_stylesheet_directory() . '/templates/footer.html' ) );

get_footer();
get_footer();
4 changes: 2 additions & 2 deletions quadrat/singular.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,11 +15,11 @@
get_header();

// the header
echo do_blocks( file_get_contents( get_stylesheet_directory() . '/templates/header.html' ) );
get_template_part( 'template-parts/header' );

echo do_blocks( '<!-- wp:post-content {"layout":{"inherit":true}} /-->' );

// the footer
echo do_blocks( file_get_contents( get_stylesheet_directory() . '/templates/footer.html' ) );

get_footer();
get_footer();
23 changes: 23 additions & 0 deletions quadrat/template-parts/header.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
<?php
/**
* Displays the header.
* Needed until we have a consistent mechanism to render a navigation between FSE and classic menus.
*
* @package Quadrat
* @since 1.0.0
*
*/

require get_stylesheet_directory() . '/inc/render-navigation-block.php';
?>

<header class="site-header" role="banner">
<?php
echo do_blocks(
'<!-- wp:group {"style":{"spacing":{"padding":{"right":"35px","left":"35px"}}}} --><div class="wp-block-group" style="padding-right:35px;padding-left:35px">
<!-- wp:site-title /-->' .
render_navigation_block( 'primary' ) .
'</div><!-- /wp:group -->'
);
?>
</header>
27 changes: 0 additions & 27 deletions quadrat/templates/header.html

This file was deleted.

Empty file removed quadrat/templates/navigation.html
Empty file.