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

Quadrat: Override BCB's index.html template #3651

Merged
merged 4 commits into from
Apr 14, 2021
Merged
Show file tree
Hide file tree
Changes from all 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
19 changes: 19 additions & 0 deletions quadrat/footer.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
<?php
/**
* The template for displaying the footer
*
* Contains the closing of the #content div and all content after.
*
* @link https://developer.wordpress.org/themes/basics/template-files/#template-partials
*
* @package WordPress
* @subpackage Quadrat
* @since 1.0.0
*/

?>

<?php wp_footer(); ?>

</body>
</html>
13 changes: 13 additions & 0 deletions quadrat/functions.php
Original file line number Diff line number Diff line change
Expand Up @@ -31,3 +31,16 @@ function quadrat_scripts() {
* Block Styles.
*/
require get_stylesheet_directory() . '/inc/block-styles.php';

/**
* Override the Parent Theme index.html template and load the index.php template from the child instead
* This may not be needed once https://github.com/WordPress/gutenberg/issues/25612#issuecomment-819419024 is addressed
*/
function quadrat_override_index_template( $template ) {
if ( is_home() || is_front_page() ) :
$template = locate_template( array( 'index.php' ) );
endif;
return $template;
}

add_filter( 'template_include', 'quadrat_override_index_template' );
29 changes: 29 additions & 0 deletions quadrat/header.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
<?php
/**
* The header for our theme
*
* This is the template that displays all of the <head> section and everything up until <div id="content">
*
* @link https://developer.wordpress.org/themes/basics/template-files/#template-partials
*
* @package WordPress
* @subpackage çQuadrat
* @since 1.0.0
*/
?><!doctype html>
<html <?php language_attributes(); ?>>
<head>
<meta charset="<?php bloginfo( 'charset' ); ?>" />
<meta name="viewport" content="width=device-width, initial-scale=1" />
<link rel="profile" href="https://gmpg.org/xfn/11" />
<?php wp_head(); ?>
</head>

<body <?php body_class(); ?>>

<?php
if ( function_exists( 'wp_body_open' ) ) {
wp_body_open();
}
?>

10 changes: 7 additions & 3 deletions quadrat/index.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,15 @@
* @package Quadrat
* @since 1.0.0
*/
get_header();

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

// the query
echo do_blocks( file_get_contents( 'templates/query.html' ) );
echo do_blocks( '<!-- wp:post-content {"layout":{"inherit":true}} /-->' );

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

get_footer();