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 Oct 1, 2021
1 parent a928e4f commit a0c7bbe
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 @@ -4,5 +4,6 @@
<!-- wp:site-title /-->
<!-- wp:site-tagline {"fontSize":"tiny"} /-->
<!-- 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 @@ -191,8 +192,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 @@ -5,5 +5,6 @@
<!-- wp:site-tagline {"fontSize":"tiny"} /-->
<!-- 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":{"typography":{"fontSize":"var(--wp--custom--font-sizes--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 @@ -17,13 +17,6 @@ function quadrat_support() {
'starter-content',
$quadrat_starter_content
);

// This theme uses wp_nav_menu() in two locations.
register_nav_menus(
array(
'primary' => __( 'Primary Navigation', 'quadrat' ),
)
);
}
add_action( 'after_setup_theme', 'quadrat_support' );
endif;
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 @@ -9,14 +9,6 @@ function skatepark_support() {
'/assets/theme.css',
)
);

//Primary navigation is used on the header and the footer pattern
register_nav_menus(
array(
'primary' => __( 'Primary Navigation', 'skatepark' ),
'social' => __( 'Social Navigation', 'skatepark' )
)
);
}
add_action( 'after_setup_theme', 'skatepark_support' );
endif;
Expand Down

0 comments on commit a0c7bbe

Please sign in to comment.