Skip to content

Commit

Permalink
[#495] Setting up basic test with nav links
Browse files Browse the repository at this point in the history
  • Loading branch information
nathan-schmidt-viget committed Feb 29, 2024
1 parent 52b117c commit fd0464a
Show file tree
Hide file tree
Showing 5 changed files with 68 additions and 1 deletion.
13 changes: 13 additions & 0 deletions client-mu-plugins/goodbids/blocks/nonprofit-navigation/block.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
{
"name": "nonprofit-navigation",
"title": "Nonprofit Navigation",
"description": "Displays the Nonprofit Navigation",
"icon": "admin-links",
"textdomain": "goodbids",
"acf": {
"mode": "preview"
},
"supports": {
"jsx": false
}
}
23 changes: 23 additions & 0 deletions client-mu-plugins/goodbids/blocks/nonprofit-navigation/block.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
<?php
/**
* Nonprofit Navigation Block
*
* @since 1.0.0
*
* @package GoodBids
*/

namespace GoodBids\Blocks;

use GoodBids\Plugins\ACF\ACFBlock;


/**
* Class for Nonprofit Navigation Block
*
* @since 1.0.0
*/
class NonprofitNavigation extends ACFBlock {


}
15 changes: 15 additions & 0 deletions client-mu-plugins/goodbids/blocks/nonprofit-navigation/render.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
<?php
/**
* Block: Nonprofit Navigation
*
* @global array $block
*
* @since 1.0.0
* @package GoodBids
*/

?>
<!-- wp:navigation -->
<!-- wp:navigation-link {"label":"About GOODBIDS","type":"page","id":3,"url":"/about","kind":"post-type"} /-->
<!-- wp:navigation-link {"label":"Explore Auctions","type":"page","id":4,"url":"/explore-auctions/","kind":"post-type"} /-->
<!-- /wp:navigation -->
11 changes: 11 additions & 0 deletions themes/goodbids-main/functions.php
Original file line number Diff line number Diff line change
Expand Up @@ -209,3 +209,14 @@ function goodbids_main_pattern_categories() {
* Disable remote block patterns.
*/
add_filter( 'should_load_remote_block_patterns', '__return_false' );


function register_home_link_block_as_navigation_last_child( $hooked_blocks, $position, $anchor_block, $context ) {
if ( $anchor_block === 'core/navigation' && $position === 'last_child' ) {
$hooked_blocks[] = 'core/loginout';
}

return $hooked_blocks;
}

add_filter( 'hooked_block_types', 'register_home_link_block_as_navigation_last_child', 10, 4 );
7 changes: 6 additions & 1 deletion themes/goodbids-nonprofit/patterns/header-nonprofit.php
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,12 @@
<!-- wp:group {"style":{"spacing":{"blockGap":"var:preset|spacing|20"}},"layout":{"type":"flex","flexWrap":"wrap"}} -->
<div class="wp-block-group">
<!-- wp:navigation {"layout":{"type":"flex","justifyContent":"right","orientation":"horizontal"},"style":{"spacing":{"margin":{"top":"0"},"blockGap":"var:preset|spacing|20"},"layout":{"selfStretch":"fit","flexSize":null}},"fontSize":"x-small"} /-->
<!-- wp:navigation -->
<!-- wp:navigation-link {"label":"test","type":"page","id":43,"url":"http://nonprofit.goodbids.vipdev.lndo.site/my-account/","kind":"post-type"} /-->
<!-- wp:navigation-link {"label":"test","type":"page","id":40,"url":"http://nonprofit.goodbids.vipdev.lndo.site/shop/","kind":"post-type"} /-->
<!-- /wp:navigation -->
<!-- wp:woocommerce/customer-account {"displayStyle":"text_only","iconStyle":"alt","iconClass":"wc-block-customer-account__account-icon","className":"btn","textColor":"contrast","fontSize":"x-small","style":{"layout":{"selfStretch":"fit","flexSize":null},"elements":{"link":{"color":{"text":"var:preset|color|contrast"}}}}} /-->
</div>
<!-- /wp:group -->
Expand Down

0 comments on commit fd0464a

Please sign in to comment.