Skip to content

Commit

Permalink
= 4.2.2.4 =
Browse files Browse the repository at this point in the history
~ Block theme: not call get_header, get_footer on block theme.
  • Loading branch information
tungnxt89 committed Mar 27, 2023
1 parent 55d6163 commit a2f83fd
Show file tree
Hide file tree
Showing 6 changed files with 14 additions and 14 deletions.
2 changes: 0 additions & 2 deletions inc/block-template/class-abstract-block-template.php
Original file line number Diff line number Diff line change
Expand Up @@ -58,8 +58,6 @@ public function render_content_block_template( array $attributes ) {
ob_start();
if ( isset( $attributes['template'] ) ) {
Template::instance()->get_frontend_template( $attributes['template'] );
} else {
Template::instance()->get_frontend_template( 'archive-course.php' );
}

$content = ob_get_clean();
Expand Down
4 changes: 3 additions & 1 deletion inc/block-template/class-block-template-archive-course.php
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,9 @@ public function __construct() {
* @return false|string
*/
public function render_content_block_template( array $attributes ) {
// Debug::var_dump($attributes);
if ( ! isset( $attributes['template'] ) ) {
$attributes['template'] = 'archive-course.php';
}
return parent::render_content_block_template( $attributes );
}
}
10 changes: 5 additions & 5 deletions templates/archive-course.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,9 @@
*
* @see LP_Template_General::template_header()
*/
//if ( empty( $is_block_theme ) ) {
// do_action( 'learn-press/template-header' );
//}
if ( ! wp_is_block_theme() ) {
do_action( 'learn-press/template-header' );
}

/**
* LP Hook
Expand Down Expand Up @@ -89,6 +89,6 @@
*
* @see LP_Template_General::template_footer()
*/
if ( empty( $is_block_theme ) ) {
//do_action( 'learn-press/template-footer' );
if ( ! wp_is_block_theme() ) {
do_action( 'learn-press/template-footer' );
}
4 changes: 2 additions & 2 deletions templates/content-single-item.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
*
* @see LP_Template_General::template_header()
*/
if ( empty( $is_block_theme ) ) {
if ( ! wp_is_block_theme() ) {
do_action( 'learn-press/template-header' );
}

Expand Down Expand Up @@ -70,6 +70,6 @@
*
* @see LP_Template_General::template_footer()
*/
if ( empty( $is_block_theme ) ) {
if ( ! wp_is_block_theme() ) {
do_action( 'learn-press/template-footer' );
}
4 changes: 2 additions & 2 deletions templates/pages/checkout.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@

defined( 'ABSPATH' ) or die;

if ( empty( $is_block_theme ) ) {
if ( ! wp_is_block_theme() ) {
get_header();
}

Expand Down Expand Up @@ -46,6 +46,6 @@
do_action( 'learnpress/template/pages/checkout/after-content' );
do_action( 'learn-press/after-main-content' );

if ( empty( $is_block_theme ) ) {
if ( ! wp_is_block_theme() ) {
get_footer();
}
4 changes: 2 additions & 2 deletions templates/single-course.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
/**
* Header for page
*/
if ( empty( $is_block_theme ) ) {
if ( ! wp_is_block_theme() ) {
get_header( 'course' );
}

Expand Down Expand Up @@ -41,6 +41,6 @@
/**
* Footer for page
*/
if ( empty( $is_block_theme ) ) {
if ( ! wp_is_block_theme() ) {
get_footer( 'course' );
}

0 comments on commit a2f83fd

Please sign in to comment.