kubio-block-footer-template-part.php
1 year ago
kubio-block-header-template-part.php
1 year ago
supported-theme-block-partials.php
1 year ago
kubio-block-header-template-part.php
27 lines
| 1 | <?php |
| 2 | |
| 3 | if ( class_exists( 'Kubio\Theme\Components\Header' ) ) { |
| 4 | class KubioBlockBasedHeaderTemplatePart extends \Kubio\Theme\Components\Header { |
| 5 | |
| 6 | protected static function getOptions() { |
| 7 | return array(); |
| 8 | } |
| 9 | |
| 10 | public function renderContent( $parameters = array() ) { |
| 11 | |
| 12 | $slug = \ColibriWP\Theme\View::isFrontPage() ? 'front-header' : 'header'; |
| 13 | $template = get_stylesheet(); |
| 14 | $part = kubio_get_block_template( "$template//$slug", 'wp_template_part' ); |
| 15 | |
| 16 | if ( $part ) { |
| 17 | global $kubio_force_render_partials_style; |
| 18 | $kubio_force_render_partials_style = true; |
| 19 | // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped |
| 20 | echo do_blocks( $part->content ); |
| 21 | } else { |
| 22 | parent::renderContent( $parameters ); |
| 23 | } |
| 24 | } |
| 25 | } |
| 26 | } |
| 27 |