Skip to content

Commit

Permalink
Blockbase: Add social navigation to blockbase themes
Browse files Browse the repository at this point in the history
  • Loading branch information
scruffian committed Aug 27, 2021
1 parent 4e133c3 commit 7f0e7f6
Show file tree
Hide file tree
Showing 9 changed files with 12 additions and 35 deletions.
3 changes: 2 additions & 1 deletion blockbase/block-template-parts/header.html
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,6 @@
<div class="wp-block-group alignfull site-header" style="padding-bottom:40px">
<!-- wp:site-title /-->
<!-- wp:navigation {"isResponsive":true,"__unstableLocation":"primary"} /-->
<!-- wp:navigation {"isResponsive":true,"__unstableLocation":"social"} /-->
</div>
<!-- /wp:group -->
<!-- /wp:group -->
7 changes: 4 additions & 3 deletions blockbase/functions.php
Original file line number Diff line number Diff line change
Expand Up @@ -30,10 +30,11 @@ function blockbase_support() {
)
);

// This theme has one menu location.
// Register two nav menus
register_nav_menus(
array(
'primary' => __( 'Primary Navigation', 'blockbase' ),
'social' => __( 'Social Navigation', 'blockbase' )
)
);

Expand Down Expand Up @@ -156,8 +157,8 @@ function blockbase_social_menu_render( $block_content, $block ) {
$nav_menu_locations = get_nav_menu_locations();
$social_menu_id = $nav_menu_locations['social'];
$class_name = 'is-style-logos-only';
if( !empty( $block['attrs']['itemsJustification'] ) && $block['attrs']['itemsJustification'] === 'right' ) {
$class_name .= ' items-justified-right';
if( !empty( $block['attrs']['itemsJustification'] ) ) {
$class_name .= ' items-justified-' . $block['attrs']['itemsJustification'];
}
$block_content = '<!-- wp:social-links {"iconColor":"primary","iconColorValue":"var(--wp--custom--color--primary)","className":"' . $class_name . '"} --><ul class="wp-block-social-links has-icon-color ' . $class_name . '">';
$menu = wp_get_nav_menu_items( $social_menu_id );
Expand Down
3 changes: 2 additions & 1 deletion mayland-blocks/block-template-parts/header.html
Original file line number Diff line number Diff line change
Expand Up @@ -4,5 +4,6 @@
<!-- wp:site-title /-->
<!-- wp:navigation {"orientation":"horizontal","textColor":"foreground-light","itemsJustification":"right","fontSize":"small","isResponsive":true,"__unstableLocation":"primary"} -->
<!-- /wp:navigation -->
<!-- wp:navigation {"orientation":"horizontal","itemsJustification":"right","isResponsive":true,"__unstableLocation":"social"} --><!-- /wp:navigation -->
</div>
<!-- /wp:group -->
<!-- /wp:group -->
7 changes: 0 additions & 7 deletions mayland-blocks/functions.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,13 +10,6 @@ function mayland_blocks_support() {
)
);

// This theme has one menu location.
register_nav_menus(
array(
'primary' => __( 'Primary Navigation', 'mayland-blocks' ),
)
);

}
add_action( 'after_setup_theme', 'mayland_blocks_support' );
endif;
Expand Down
3 changes: 2 additions & 1 deletion quadrat/block-template-parts/header.html
Original file line number Diff line number Diff line change
Expand Up @@ -4,5 +4,6 @@
<!-- wp:site-title /-->
<!-- wp:site-tagline {"style":{"spacing":{"padding":{"top":"0px","right":"0px","bottom":"0px","left":"20px"},"margin":{"right":"auto"}}},"fontSize":"tiny"} /-->
<!-- wp:navigation {"isResponsive":true,"__unstableLocation":"primary"} /-->
<!-- wp:navigation {"orientation":"horizontal","itemsJustification":"right","isResponsive":true,"__unstableLocation":"social"} --><!-- /wp:navigation -->
</header>
<!-- /wp:group -->
<!-- /wp:group -->
7 changes: 0 additions & 7 deletions quadrat/functions.php
Original file line number Diff line number Diff line change
Expand Up @@ -29,13 +29,6 @@ function quadrat_support() {
$quadrat_starter_content
);

// This theme uses wp_nav_menu() in two locations.
register_nav_menus(
array(
'primary' => __( 'Primary Navigation', 'quadrat' ),
)
);

remove_theme_support( 'block-templates' );
}
add_action( 'after_setup_theme', 'quadrat_support' );
Expand Down
2 changes: 2 additions & 0 deletions seedlet-blocks/block-template-parts/header.html
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@
<!-- wp:navigation {"itemsJustification":"center","isResponsive":true,"__unstableLocation":"primary"} -->
<!-- /wp:navigation -->

<!-- wp:navigation {"orientation":"horizontal","itemsJustification":"center","isResponsive":true,"__unstableLocation":"social"} --><!-- /wp:navigation -->

<!-- wp:spacer {"height":60} -->
<div style="height:60px" aria-hidden="true" class="wp-block-spacer"></div>
<!-- /wp:spacer -->
7 changes: 0 additions & 7 deletions seedlet-blocks/functions.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,13 +12,6 @@ function seedlet_blocks_support() {
)
);

// This theme has one menu location.
register_nav_menus(
array(
'primary' => __( 'Primary Navigation', 'seedlet-blocks' ),
)
);

}
add_action( 'after_setup_theme', 'seedlet_blocks_support' );

Expand Down
8 changes: 0 additions & 8 deletions skatepark/functions.php
Original file line number Diff line number Diff line change
Expand Up @@ -21,14 +21,6 @@ function skatepark_support() {
)
);

//Primary navigation is used on the header and the footer pattern
register_nav_menus(
array(
'primary' => __( 'Primary Navigation', 'skatepark' ),
'social' => __( 'Social Navigation', 'blockbase' )
)
);

remove_theme_support( 'block-templates' );
}
add_action( 'after_setup_theme', 'skatepark_support' );
Expand Down

0 comments on commit 7f0e7f6

Please sign in to comment.