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 authored and jffng committed Sep 1, 2021
1 parent 646c6a0 commit b97a262
Show file tree
Hide file tree
Showing 9 changed files with 9 additions and 32 deletions.
1 change: 1 addition & 0 deletions 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 -->
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 @@ -158,8 +159,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
1 change: 1 addition & 0 deletions 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 -->
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
1 change: 1 addition & 0 deletions 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 -->
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', 'skatepark' )
)
);

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

0 comments on commit b97a262

Please sign in to comment.