Skip to content

Commit

Permalink
1.5.0 - Testing FSE block template parts
Browse files Browse the repository at this point in the history
  • Loading branch information
webmandesign committed Nov 9, 2022
1 parent de28c9c commit 98833d3
Show file tree
Hide file tree
Showing 11 changed files with 93 additions and 13 deletions.
2 changes: 1 addition & 1 deletion assets/css/editor-style-classic-rtl.css

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion assets/css/editor-style-classic.css

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion assets/css/global-rtl.css

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion assets/css/global.css

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion assets/scss/global/wp/_alignment.scss
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@
margin-right: 0;
}

.has-background.has-background & {
.alignfull.has-background & {
width: auto;
margin-left: calc( -1 * var(--body_padding) );
margin-right: calc( -1 * var(--body_padding) );
Expand Down
11 changes: 11 additions & 0 deletions changelog.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,16 @@
# Michelle Changelog

## 1.5.0, 20221110

### Fixed
- WordPress 6.1 compatibility

### File updates
changelog.md
readme.txt
style.css


## 1.4.0, 20221102

### Fixed
Expand Down
81 changes: 75 additions & 6 deletions includes/Content/Block_Area.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
* @copyright WebMan Design, Oliver Juhas
*
* @since 1.0.6
* @version 1.3.0
* @version 1.5.0
*/

namespace WebManDesign\Michelle\Content;
Expand All @@ -21,7 +21,8 @@ class Block_Area implements Component_Interface {
/**
* Initialization.
*
* @since 1.0.6
* @since 1.0.6
* @version 1.5.0
*
* @return void
*/
Expand All @@ -31,12 +32,71 @@ public static function init() {

// Actions

add_action( 'after_setup_theme', __CLASS__ . '::after_setup_theme' );

add_action( 'michelle/content/404', __CLASS__ . '::error_404' );

add_action( 'tha_footer_top', __CLASS__ . '::footer' );

} // /init

/**
* After setup theme.
*
* @since 1.5.0
*
* @return void
*/
public static function after_setup_theme() {

// Processing

add_theme_support( 'block-template-parts' );

} // /after_setup_theme

/**
* Gets WordPress 6.1+ block template part content.
*
* This is basically WordPress' `block_template_part()` function adapted
* for our purpose - to return content instead of echoing it.
*
* @since 1.5.0
*
* @param string $part Name of block template part found in `parts` folder.
*
* @return string
*/
public static function get_template_part_content( string $part = '' ): string {

// Requirements check

if (
empty( $part )
|| ! function_exists( 'block_template_part' )
) {
return '';
}


// Variables

$template_part = get_block_template( get_stylesheet() . '//' . $part, 'wp_template_part' );

if (
! $template_part
|| empty( $template_part->content )
) {
return '';
}


// Output

return trim( (string) do_blocks( $template_part->content ) );

} // /get_template_part_content

/**
* Get block area post type key.
*
Expand All @@ -63,31 +123,40 @@ public static function get_post_type(): string {
* Site footer content.
*
* @since 1.0.0
* @version 1.3.0
* @version 1.5.0
*
* @return void
*/
public static function footer() {

// Output

get_template_part( 'templates/parts/block/area/footer' );
if ( ! empty( self::get_template_part_content( 'footer' ) ) ) {
remove_action( 'tha_footer_bottom', 'WebManDesign\Michelle\Footer\Component::site_info', 100 );
block_template_part( 'footer' );
} else {
get_template_part( 'templates/parts/block/area/footer' );
}

} // /footer

/**
* Error 404 page content.
*
* @since 1.0.6
* @version 1.3.0
* @version 1.5.0
*
* @return void
*/
public static function error_404() {

// Output

get_template_part( 'templates/parts/block/area/404' );
if ( ! empty( self::get_template_part_content( 'error-404' ) ) ) {
block_template_part( 'error-404' );
} else {
get_template_part( 'templates/parts/block/area/404' );
}

} // /error_404

Expand Down
Empty file added parts/error-404.html
Empty file.
Empty file added parts/footer.html
Empty file.
2 changes: 1 addition & 1 deletion readme.txt
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ Please see `changelog.md` file.

== Upgrade Notice ==

= 1.4.0 =
= 1.5.0 =
Fixing WordPress 6.1 compatibility.


Expand Down
2 changes: 1 addition & 1 deletion style.css
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ Theme Name: Michelle
Theme URI: https://www.webmandesign.eu/portfolio/michelle-wordpress-theme/
Author: WebMan Design
Author URI: https://www.webmandesign.eu/
Version: 1.4.0
Version: 1.5.0
Text Domain: michelle
Domain Path: /languages
License: GPL-3.0-or-later
Expand Down

0 comments on commit 98833d3

Please sign in to comment.