Skip to content

Commit

Permalink
Add header frontend fallback (#222)
Browse files Browse the repository at this point in the history
* Add header frontend fallback

* Add frontend fallback from Nova

* Compile
  • Loading branch information
madalingorbanescu authored Feb 11, 2021
1 parent 3c9e4af commit 3c0dea8
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 2 deletions.
1 change: 1 addition & 0 deletions dist/nova-blocks/block-library/blocks/header/frontend.js

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

7 changes: 6 additions & 1 deletion functions.php
Original file line number Diff line number Diff line change
Expand Up @@ -205,7 +205,12 @@ function rosa2_scripts() {
}
}

wp_enqueue_style( 'rosa2-style', get_template_directory_uri() . '/style.css', array(
// Nova Blocks Header Block frontend.js fallback
if ( ! rosa2_is_using_block( 'header', true ) ) {
wp_enqueue_script( 'novablocks/header/frontend', get_template_directory_uri() . '/dist/nova-blocks/block-library/blocks/header/frontend' . $suffix . '.js', array(), null, true );
}

wp_enqueue_style( 'rosa2-style', get_template_directory_uri() . '/style.css', array(
'rosa2-social-links',
'rosa2-custom-properties',
'rosa2-theme',
Expand Down
5 changes: 4 additions & 1 deletion template-parts/site-header.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,12 @@
}

get_template_part( 'template-parts/menu-toggle' );

$site_header_is_sticky = pixelgrade_option( 'header_position', 'sticky' ) === 'sticky';
$sticky_attribute = $site_header_is_sticky ? 'data-sticky=true' : '';
?>

<header id="masthead" class="site-header site-header--main site-header--logo-center">
<header id="masthead" class="site-header site-header--main site-header--logo-center" <?php echo $sticky_attribute; ?>>
<div class="site-header__wrapper">
<div class="site-header__inner-container">
<div class="site-header__content alignfull">
Expand Down

0 comments on commit 3c0dea8

Please sign in to comment.