Skip to content

Commit

Permalink
[#11] Main Header and Footer (#112)
Browse files Browse the repository at this point in the history
* [#11] setting up header and footer of main theme

* [#11] setting up footer block

* [#11] refactor footer

* [#11] moving block editor lock into plugin

* [#11] Rename footer block
  • Loading branch information
nathan-schmidt-viget authored Dec 21, 2023
1 parent 2bcd18f commit 0bfacea
Show file tree
Hide file tree
Showing 7 changed files with 90 additions and 153 deletions.
13 changes: 13 additions & 0 deletions client-mu-plugins/goodbids/blocks/main-footer/block.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
{
"name": "main-footer",
"title": "Main Footer",
"description": "Displays the main site footer",
"icon": "text-page",
"textdomain": "goodbids",
"acf": {
"mode": "preview"
},
"supports": {
"jsx": false
}
}
37 changes: 37 additions & 0 deletions client-mu-plugins/goodbids/blocks/main-footer/render.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
<?php
/**
* Block: Main Footer
*
* @global array $block
*
* @since 1.0.0
* @package GoodBids
*/

?>

<section <?php block_attr( $block, 'wp-block-group alignwide has-background has-global-padding is-layout-constrained wp-block-group-is-layout-constrained' ); ?>>
<div class="wp-block-group alignwide has-global-padding is-layout-constrained wp-block-group-is-layout-constrained">
<div class="wp-block-group alignwide has-small-font-size is-content-justification-space-between is-nowrap is-layout-flex wp-container-core-group-layout-30 wp-block-group-is-layout-flex" style="margin-top:var(--wp--preset--spacing--40);margin-bottom:var(--wp--preset--spacing--40);justify-content: space-between;flex-wrap: wrap;">

<p><?php esc_html_e( 'GOODBIDS Positive Auctions', 'goodbids' ); ?></p>

<div class="wp-block-group is-nowrap is-layout-flex wp-container-core-group-layout-29 wp-block-group-is-layout-flex">
<?php
printf(
'<p><a href="%s">%s</a></p>',
esc_html__( '#', 'goodbids' ),
esc_html__( 'Terms & Conditions', 'goodbids' )
);
?>
<?php
printf(
'<p><a href="%s">%s</a></p>',
esc_html__( '#', 'goodbids' ),
esc_html__( 'Privacy Policy', 'goodbids' )
);
?>
</div>
</div>
</div>
</section>
22 changes: 22 additions & 0 deletions client-mu-plugins/goodbids/src/classes/Network/Sites.php
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@ public function __construct() {
$this->activate_child_theme_on_new_site();
$this->default_child_theme_logo();
$this->set_default_posts_per_page();
$this->lock_block_editor();
}

/**
Expand Down Expand Up @@ -436,4 +437,25 @@ function ( int $site_id ): void {
}
);
}

/**
* Only allow super admins to lock and unlock blocks.
*
* @since 1.0.0
*
* @return void
*/
private function lock_block_editor(): void {
add_filter(
'block_editor_settings_all',
static function ( $settings, $context ) {
if ( ! is_super_admin() ) {
$settings['canLockBlocks'] = false;
}
return $settings;
},
10,
2
);
}
}
28 changes: 15 additions & 13 deletions themes/goodbids-main/parts/header.html
Original file line number Diff line number Diff line change
@@ -1,22 +1,24 @@
<!-- wp:group {"align":"wide","style":{"spacing":{"padding":{"top":"20px","bottom":"20px"}}},"backgroundColor":"base","layout":{"type":"constrained"}} -->
<div class="wp-block-group alignwide has-base-background-color has-background"
style="padding-top:20px;padding-bottom:20px">
<!-- wp:group {"align":"wide","style":{"spacing":{"padding":{"top":"20px","bottom":"20px"}}},"layout":{"type":"constrained"}} -->
<div
class="wp-block-group alignwide has-background"
style="padding-top: 20px; padding-bottom: 20px"
>
<!-- wp:group {"align":"wide","layout":{"type":"flex","justifyContent":"space-between","flexWrap":"wrap"}} -->
<div class="wp-block-group alignwide">
<!-- wp:group {"style":{"spacing":{"blockGap":"var:preset|spacing|20"},"layout":{"selfStretch":"fit","flexSize":null}},"layout":{"type":"flex"}} -->
<!-- wp:group {"style":{"spacing":{"blockGap":"0.2rem"},"layout":{"selfStretch":"fit","flexSize":null}},"layout":{"type":"flex"}} -->
<div class="wp-block-group">
<!-- wp:site-logo {"width":60 } /-->

<!-- wp:group {"style":{"spacing":{"blockGap":"0px"}}} -->
<div class="wp-block-group">
<!-- wp:site-title {"level":0} /-->
</div>
<!-- /wp:group -->
<!-- wp:site-logo {"width":160,"shouldSyncIcon":true,"style":{"spacing":{"margin":{"top":"0","bottom":"0","left":"0","right":"0.5rem"}}}} /-->
</div>
<!-- /wp: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}}} /-->
<!-- 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:loginout {"className":"wp-button-custom","style":{"spacing":{"margin":{"top":"0"},"blockGap":"var:preset|spacing|20"},"layout":{"selfStretch":"fit","flexSize":null}},"textColor":"base-2","fontSize":"x-small"} /-->
</div>
<!-- /wp:group -->
</div>

<!-- /wp:group -->
</div>
<!-- /wp:group -->
<!-- /wp:group -->
122 changes: 2 additions & 120 deletions themes/goodbids-main/patterns/footer.php
Original file line number Diff line number Diff line change
@@ -1,128 +1,10 @@
<?php
/**
* Title: Footer with colophon, 4 columns
* Title: Main Footer
* Slug: goodbids-main/footer
* Categories: footer
* Block Types: core/template-part/footer
*/
?>

<!-- wp:group {"style":{"spacing":{"padding":{"top":"var:preset|spacing|50","bottom":"var:preset|spacing|50"}}},"layout":{"type":"constrained"}} -->
<div class="wp-block-group" style="padding-top:var(--wp--preset--spacing--50);padding-bottom:var(--wp--preset--spacing--50)">
<!-- wp:columns {"align":"wide"} -->
<div class="wp-block-columns alignwide">
<!-- wp:column {"width":"30%"} -->
<div class="wp-block-column" style="flex-basis:30%">
<!-- wp:group {"style":{"dimensions":{"minHeight":""},"layout":{"selfStretch":"fit","flexSize":null}},"layout":{"type":"flex","orientation":"vertical"}} -->
<div class="wp-block-group">
<!-- wp:site-logo {"width":20,"shouldSyncIcon":true,"style":{"layout":{"selfStretch":"fit","flexSize":null}}} /-->

<!-- wp:site-title {"level":0,"fontSize":"medium"} /-->

<!-- wp:site-tagline {"fontSize":"small"} /-->
</div>
<!-- /wp:group -->
</div>
<!-- /wp:column -->

<!-- wp:column {"width":"20%"} -->
<div class="wp-block-column" style="flex-basis:20%">
</div>
<!-- /wp:column -->

<!-- wp:column {"width":"50%"} -->
<div class="wp-block-column" style="flex-basis:50%">
<!-- wp:group {"layout":{"type":"flex","flexWrap":"wrap","justifyContent":"space-between","verticalAlignment":"top"}} -->
<div class="wp-block-group">
<!-- wp:group {"layout":{"type":"flex","orientation":"vertical","justifyContent":"stretch"}} -->
<div class="wp-block-group">
<!-- wp:heading {"level":2,"style":{"typography":{"fontStyle":"normal","fontWeight":"600"}},"fontFamily":"body"} -->
<h2 class="wp-block-heading has-medium-font-size has-body-font-family" style="font-style:normal;font-weight:600"><?php esc_html_e( 'About', 'goodbids-main' ); ?></h2>
<!-- /wp:heading -->

<!-- wp:group {"style":{"spacing":{"blockGap":"var:preset|spacing|10"}},"layout":{"type":"flex","orientation":"vertical"}} -->
<div class="wp-block-group">

<!-- wp:navigation {"overlayMenu":"never","layout":{"type":"flex","orientation":"vertical"},"style":{"typography":{"fontStyle":"normal","fontWeight":"400"},"spacing":{"blockGap":"var:preset|spacing|10"}},"fontSize":"small","ariaLabel":"<?php esc_attr_e( 'About', 'goodbids-main' ); ?>"} -->

<!-- wp:navigation-link {"label":"Team","url":"#"} /-->
<!-- wp:navigation-link {"label":"History","url":"#"} /-->
<!-- wp:navigation-link {"label":"Careers","url":"#"} /-->

<!-- /wp:navigation -->

</div>
<!-- /wp:group -->
</div>

<!-- /wp:group -->

<!-- wp:group {"layout":{"type":"flex","orientation":"vertical","justifyContent":"stretch"}} -->
<div class="wp-block-group">
<!-- wp:heading {"level":2,"style":{"typography":{"fontStyle":"normal","fontWeight":"600"}},"fontFamily":"body"} -->
<h2 class="wp-block-heading has-medium-font-size has-body-font-family" style="font-style:normal;font-weight:600"><?php esc_html_e( 'Privacy', 'goodbids-main' ); ?></h2>
<!-- /wp:heading -->

<!-- wp:group {"style":{"spacing":{"blockGap":"var:preset|spacing|10"}},"layout":{"type":"flex","orientation":"vertical"}} -->
<div class="wp-block-group">

<!-- wp:navigation {"overlayMenu":"never","layout":{"type":"flex","orientation":"vertical"},"style":{"typography":{"fontStyle":"normal","fontWeight":"400"},"spacing":{"blockGap":"var:preset|spacing|10"}},"fontSize":"small","ariaLabel":"<?php esc_attr_e( 'Privacy', 'goodbids-main' ); ?>"} -->

<!-- wp:navigation-link {"label":"Privacy Policy","url":"#"} /-->
<!-- wp:navigation-link {"label":"Terms and Conditions","url":"#"} /-->
<!-- wp:navigation-link {"label":"Contact Us","url":"#"} /-->

<!-- /wp:navigation -->

</div>
<!-- /wp:group -->
</div>
<!-- /wp:group -->

<!-- wp:group {"layout":{"type":"flex","orientation":"vertical","justifyContent":"stretch"}} -->
<div class="wp-block-group">
<!-- wp:heading {"level":2,"style":{"typography":{"fontStyle":"normal","fontWeight":"600"}},"fontFamily":"body"} -->
<h2 class="wp-block-heading has-medium-font-size has-body-font-family" style="font-style:normal;font-weight:600"><?php esc_html_e( 'Social', 'goodbids-main' ); ?></h2>
<!-- /wp:heading -->

<!-- wp:group {"style":{"spacing":{"blockGap":"var:preset|spacing|10"}},"layout":{"type":"flex","orientation":"vertical"}} -->
<div class="wp-block-group">

<!-- wp:navigation {"overlayMenu":"never","layout":{"type":"flex","orientation":"vertical"},"style":{"typography":{"fontStyle":"normal","fontWeight":"400"},"spacing":{"blockGap":"var:preset|spacing|10"}},"fontSize":"small","ariaLabel":"<?php esc_attr_e( 'Social Media', 'goodbids-main' ); ?>"} -->

<!-- wp:navigation-link {"label":"Facebook","url":"#"} /-->
<!-- wp:navigation-link {"label":"Instagram","url":"#"} /-->
<!-- wp:navigation-link {"label":"Twitter/X","url":"#"} /-->

<!-- /wp:navigation -->

</div>
<!-- /wp:group -->
</div>
<!-- /wp:group -->
</div>
<!-- /wp:group -->
</div>
<!-- /wp:column -->
</div>
<!-- /wp:columns -->

<!-- wp:group {"align":"wide","style":{"spacing":{"padding":{"top":"var:preset|spacing|50","bottom":"0"}}}} -->
<div class="wp-block-group alignwide" style="padding-top:var(--wp--preset--spacing--50);padding-bottom:0">
<!-- wp:paragraph {"style":{"elements":{"link":{"color":{"text":"var:preset|color|contrast"}}}},"textColor":"contrast-2","fontSize":"small"} -->
<p class="has-contrast-2-color has-text-color has-link-color has-small-font-size">
<?php
/* Translators: WordPress link. */
$wordpress_link = '<a href="' . esc_url( __( 'https://wordpress.org', 'goodbids-main' ) ) . '" rel="nofollow">WordPress</a>';
printf(
/* Translators: Designed with WordPress */
esc_html__( 'Designed with %1$s', 'goodbids-main' ),
$wordpress_link
);
?>
</p>
<!-- /wp:paragraph -->
</div>
<!-- /wp:group -->
</div>
<!-- /wp:group -->
<!-- wp:acf/main-footer {"name":"acf/main-footer","mode":"preview","lock":{"move":true,"remove":true}} /-->
1 change: 1 addition & 0 deletions themes/goodbids-nonprofit/parts/footer.html
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
<!-- wp:pattern {"slug":"goodbids-np/footer-nonprofit"} /-->
<!-- wp:pattern {"slug":"goodbids-main/footer"} /-->
20 changes: 0 additions & 20 deletions themes/goodbids-nonprofit/patterns/footer-nonprofit.php
Original file line number Diff line number Diff line change
Expand Up @@ -29,26 +29,6 @@
<!-- /wp:group -->
</div>
<!-- /wp:group -->

<!-- wp:group {"templateLock":"all","lock":{"move":true,"remove":true},"align":"wide","style":{"spacing":{"margin":{"top":"var:preset|spacing|40","bottom":"var:preset|spacing|40"}}},"layout":{"type":"flex","flexWrap":"nowrap","justifyContent":"space-between"},"fontSize":"small"} -->
<div class="wp-block-group alignwide has-small-font-size" style="margin-top:var(--wp--preset--spacing--40);margin-bottom:var(--wp--preset--spacing--40)">
<!-- wp:paragraph -->
<p><?php esc_html_e( 'GOODBIDS positive auctions', 'goodbids-nonprofit' ); ?></p>
<!-- /wp:paragraph -->

<!-- wp:group {"style":{"spacing":{"blockGap":"var:preset|spacing|20"}},"layout":{"type":"flex","flexWrap":"nowrap"}} -->
<div class="wp-block-group">
<!-- wp:paragraph -->
<p><a href="#"><?php esc_html_e( 'Terms &amp; Conditions', 'goodbids-nonprofit' ); ?></a></p>
<!-- /wp:paragraph -->

<!-- wp:paragraph -->
<p><a href="#"><?php esc_html_e( 'Privacy Policy', 'goodbids-nonprofit' ); ?></a></p>
<!-- /wp:paragraph -->
</div>
<!-- /wp:group -->
</div>
<!-- /wp:group -->
</div>
<!-- /wp:group -->
</div>
Expand Down

0 comments on commit 0bfacea

Please sign in to comment.