Add __unstableLocation to all BB&Co Themes (#4101)

* Add __unstableLocation to all BB&Co Themes

As BB & Co. themes ALL become "Universal Capable" this addition allows
the menues to be modifed (should these themes be used in "Classic Mode")

* Registered menu locations for all BB themes
This commit is contained in:
Jason Crist 2021-06-28 05:51:45 -04:00 committed by GitHub
parent 1392fe1de3
commit c562229404
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
9 changed files with 44 additions and 9 deletions

View file

@ -1,6 +1,6 @@
<!-- wp:group {"align":"full","className":"site-header"} -->
<div class="wp-block-group alignfull site-header">
<!-- wp:site-title /-->
<!-- wp:navigation {"isResponsive":true} /-->
<!-- wp:navigation {"isResponsive":true,"__unstableLocation":"primary"} --><!-- /wp:navigation -->
</div>
<!-- /wp:group -->

View file

@ -18,12 +18,23 @@ if ( ! function_exists( 'blockbase_support' ) ) :
// Add support for post thumbnails.
add_theme_support( 'post-thumbnails' );
// Experimental support for adding blocks inside nav menus
add_theme_support( 'block-nav-menus' );
// Enqueue editor styles.
add_editor_style(
array(
'/assets/ponyfill.css',
)
);
// This theme has one menu location.
register_nav_menus(
array(
'primary' => __( 'Primary Navigation', 'blockbase' ),
)
);
}
add_action( 'after_setup_theme', 'blockbase_support' );
endif;

View file

@ -1,4 +1,4 @@
<!-- wp:site-logo /-->
<!-- wp:site-title /-->
<!-- wp:navigation {"orientation":"horizontal","textColor":"foreground-light","itemsJustification":"right","fontSize":"small","isResponsive":true} -->
<!-- wp:navigation {"orientation":"horizontal","textColor":"foreground-light","itemsJustification":"right","fontSize":"small","isResponsive":true,"__unstableLocation":"primary"} -->
<!-- /wp:navigation -->

View file

@ -9,6 +9,14 @@ if ( ! function_exists( 'mayland_blocks_support' ) ) :
'theme.css',
)
);
// This theme has one menu location.
register_nav_menus(
array(
'primary' => __( 'Primary Navigation', 'mayland-blocks' ),
)
);
}
add_action( 'after_setup_theme', 'mayland_blocks_support' );
endif;

View file

@ -10,9 +10,6 @@ if ( ! function_exists( 'quadrat_support' ) ) :
)
);
// Experimental support for adding blocks inside nav menus
add_theme_support( 'block-nav-menus' );
// Add support for core custom logo.
add_theme_support(
'custom-logo',

View file

@ -175,6 +175,10 @@
line-height: 30px;
}
.wp-block-navigation__container {
justify-content: center;
}
.wp-block-post-comments .reply a {
border-radius: var(--wp--custom--button--border--radius);
font-size: var(--wp--preset--font-size--small);

View file

@ -8,7 +8,7 @@
<!-- wp:site-tagline {"textAlign":"center","fontSize":"small"} /-->
<!-- wp:navigation {"itemsJustification":"center","isResponsive":true} -->
<!-- wp:navigation {"itemsJustification":"center","isResponsive":true,"__unstableLocation":"primary"} -->
<!-- /wp:navigation -->
<!-- wp:spacer {"height":60} -->

View file

@ -3,22 +3,31 @@
/**
* Add Editor Styles
*/
function seedlet_blocks_editor_styles() {
function seedlet_blocks_support() {
// Enqueue editor styles.
add_editor_style(
array(
'/assets/theme.css',
)
);
// This theme has one menu location.
register_nav_menus(
array(
'primary' => __( 'Primary Navigation', 'seedlet-blocks' ),
)
);
}
add_action( 'after_setup_theme', 'seedlet_blocks_editor_styles' );
add_action( 'after_setup_theme', 'seedlet_blocks_support' );
/**
*
* Enqueue scripts and styles.
*/
function seedlet_blocks_scripts() {
wp_enqueue_style( 'seedlet_blocks-styles', get_stylesheet_directory_uri() . '/assets/theme.css', array('blockbase-ponyfill'), wp_get_theme()->get( 'Version' ) );
wp_enqueue_style( 'seedlet_blocks-styles', get_stylesheet_directory_uri() . '/assets/theme.css', array( 'blockbase-ponyfill' ), wp_get_theme()->get( 'Version' ) );
}
add_action( 'wp_enqueue_scripts', 'seedlet_blocks_scripts' );

View file

@ -16,4 +16,10 @@
}
}
}
}
/* NOTE: This can be removed when the rendering of the Navigation block, rendered with a Classic data source (by way of __unstableLocation),
is passed all of the block attributes on the block definition in the template. */
.wp-block-navigation__container {
justify-content: center;
}