Skip to content

Commit

Permalink
[#10] About template
Browse files Browse the repository at this point in the history
[#10] setting up page template
[#10] updating types and category
[#10] Refactoring files removing header/footer
[#10] updating about template
  • Loading branch information
nathan-schmidt-viget committed Dec 12, 2023
1 parent 8665dca commit bb4c963
Show file tree
Hide file tree
Showing 4 changed files with 70 additions and 10 deletions.
2 changes: 1 addition & 1 deletion client-mu-plugins/goodbids/src/classes/plugins/ACF.php
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ private function disable_admin() : void {

/**
* Save ACF JSON to the plugin directory, but only when developing locally.
* We don't want to break this feature if the non-profit is using ACF.
* We don't want to break this feature if the nonprofit is using ACF.
*
* @since 1.0.0
*
Expand Down
32 changes: 24 additions & 8 deletions themes/goodbids-nonprofit/inc/patterns.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
'init',
function () {
register_block_pattern_category(
'goodBids-nonprofit',
'goodbids-np',
[
'label' => __( 'GoodBids Nonprofit', 'goodbids-nonprofit' ),
]
Expand All @@ -35,23 +35,40 @@ function () {
$patterns = [
[
'name' => 'template-home-nonprofit',
'path' => 'patterns/template-home-nonprofit.php',
'title' => __( 'Nonprofit Home Template', 'goodbids-nonprofit' ),
'file' => 'patterns/template-home-nonprofit.php',
'title' => __( 'GoodBids Home Template', 'goodbids-nonprofit' ),
'description' => _x( 'Template for the Nonprofit Homepage', 'Block pattern description', 'goodbids-nonprofit' ),
'categories' => [ 'featured', 'goodBids-nonprofit' ],
'categories' => [ 'featured', 'goodbids-np' ],
'keywords' => [ 'home', 'non-profit', 'template', 'page' ],
'templateTypes' => [ 'front-page', 'home', 'page' ],
'source' => 'theme',
],
[
'name' => 'about-nonprofit',
'file' => 'patterns/about-nonprofit.php',
'title' => __( 'About GoodBids', 'goodbids-nonprofit' ),
'description' => _x( 'Template for About Page', 'Block pattern description', 'goodbids-nonprofit' ),
'categories' => [ 'about','page', 'goodbids-np' ],
'keywords' => [ 'non-profit', 'starter', 'page' ],
'blockTypes' => [ 'core/post-content', 'core/group', 'core/paragraph' ],
'postTypes' => [ 'page', 'wp_template' ],
'templateTypes' => [ 'front-page', 'home', 'page' ],
'source' => 'theme',
],
];

foreach ( $patterns as $pattern ) {
if ( ! file_exists( get_stylesheet_directory() . '/' . $pattern['path'] ) ) {
if ( ! file_exists( get_stylesheet_directory() . '/' . $pattern['file'] ) ) {
continue;
}

$path = get_stylesheet_directory() . '/' . $pattern['path'];
$file = $pattern['file'];
$name = $pattern['name'];
$path = get_stylesheet_directory() . '/' . $file;
$extension = pathinfo( $path, PATHINFO_EXTENSION );

unset( $pattern['file'], $pattern['name'] );

if ( 'php' === $extension ) {
ob_start();
include $path;
Expand All @@ -61,10 +78,9 @@ function () {
}

$pattern['content'] = $content;
unset( $pattern['path'] );

register_block_pattern(
'goodbids-nonprofit/' . $pattern['name'],
'goodbids-np/' . $name,
$pattern
);
}
Expand Down
45 changes: 45 additions & 0 deletions themes/goodbids-nonprofit/patterns/about-nonprofit.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
<!-- wp:group {"tagName":"main"} -->
<main class="wp-block-group"><!-- wp:group {"layout":{"type":"constrained"}} -->
<div class="wp-block-group"><!-- wp:spacer {"height":"var:preset|spacing|50"} -->
<div style="height:var(--wp--preset--spacing--50)" aria-hidden="true" class="wp-block-spacer"></div>
<!-- /wp:spacer -->

<!-- wp:post-title {"textAlign":"center","level":1} /-->

<!-- wp:spacer {"height":"var:preset|spacing|30","style":{"spacing":{"margin":{"top":"0","bottom":"0"}}}} -->
<div style="margin-top:0;margin-bottom:0;height:var(--wp--preset--spacing--30)" aria-hidden="true" class="wp-block-spacer"></div>
<!-- /wp:spacer -->

<!-- wp:post-featured-image {"height":"400px","style":{"spacing":{"margin":{"bottom":"var:preset|spacing|40"}}}} /--></div>
<!-- /wp:group --></main>
<!-- /wp:group -->

<!-- wp:paragraph -->
<p><?php echo esc_html_x( 'Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Nunc id cursus metus aliquam eleifend mi in nulla posuere. Morbi tempus iaculis urna id volutpat lacus. Duis ut diam quam nulla porttitor massa id neque. Ac turpis egestas maecenas pharetra convallis posuere. Nulla posuere sollicitudin aliquam ultrices sagittis. Amet mauris commodo quis imperdiet massa. Odio aenean sed adipiscing diam donec adipiscing. Ultricies integer quis auctor elit sed. Massa sed elementum tempus egestas sed sed risus pretium quam. Eget sit amet tellus cras adipiscing. Sagittis vitae et leo duis ut diam quam nulla porttitor. Id semper risus in hendrerit gravida rutrum. Lorem mollis aliquam ut porttitor leo a. Elementum nibh tellus molestie nunc non blandit massa. Eu facilisis sed odio morbi quis commodo odio.', 'About details block', 'goodbids-nonprofit' ); ?></p>
<!-- /wp:paragraph -->

<!-- wp:group {"align":"full","style":{"spacing":{"padding":{"top":"var:preset|spacing|50","bottom":"var:preset|spacing|50","left":"var:preset|spacing|50","right":"var:preset|spacing|50"},"margin":{"top":"0","bottom":"0"}}},"layout":{"type":"constrained"}} -->
<div class="wp-block-group alignfull" style="margin-top:0;margin-bottom:0;padding-top:var(--wp--preset--spacing--50);padding-right:var(--wp--preset--spacing--50);padding-bottom:var(--wp--preset--spacing--50);padding-left:var(--wp--preset--spacing--50)"><!-- wp:group {"align":"wide","style":{"border":{"radius":"16px"},"spacing":{"padding":{"top":"var:preset|spacing|40","bottom":"var:preset|spacing|40","left":"var:preset|spacing|50","right":"var:preset|spacing|50"}}},"backgroundColor":"contrast","layout":{"type":"constrained"}} -->
<div class="wp-block-group alignwide has-contrast-background-color has-background" style="border-radius:16px;padding-top:var(--wp--preset--spacing--40);padding-right:var(--wp--preset--spacing--50);padding-bottom:var(--wp--preset--spacing--40);padding-left:var(--wp--preset--spacing--50)"><!-- wp:spacer {"height":"var:preset|spacing|10"} -->
<div style="height:var(--wp--preset--spacing--10)" aria-hidden="true" class="wp-block-spacer"></div>
<!-- /wp:spacer -->

<!-- wp:heading {"textAlign":"center","style":{"elements":{"link":{"color":{"text":"var:preset|color|base"}}}},"textColor":"base","fontSize":"x-large"} -->
<h2 class="wp-block-heading has-text-align-center has-base-color has-text-color has-link-color has-x-large-font-size"><?php esc_html_e( 'Join 900+ subscribers', 'goodbids-nonprofit' ); ?></h2>
<!-- /wp:heading -->

<!-- wp:paragraph {"align":"center","style":{"elements":{"link":{"color":{"text":"var:preset|color|base"}}}},"textColor":"base"} -->
<p class="has-text-align-center has-base-color has-text-color has-link-color"><?php esc_html_e( 'Stay in the loop with everything you need to know.', 'goodbids-nonprofit' ); ?></p>
<!-- /wp:paragraph -->

<!-- wp:buttons {"layout":{"type":"flex","justifyContent":"center"}} -->
<div class="wp-block-buttons"><!-- wp:button {"backgroundColor":"contrast-4","textColor":"contrast","style":{"elements":{"link":{"color":{"text":"var:preset|color|contrast"}}}},"className":"is-style-fill"} -->
<div class="wp-block-button is-style-fill"><a class="wp-block-button__link has-contrast-color has-contrast-4-background-color has-text-color has-background has-link-color wp-element-button"><?php esc_html_e( 'Sign up', 'goodbids-nonprofit' ); ?></a></div>
<!-- /wp:button --></div>
<!-- /wp:buttons -->

<!-- wp:spacer {"height":"var:preset|spacing|10"} -->
<div style="height:var(--wp--preset--spacing--10)" aria-hidden="true" class="wp-block-spacer"></div>
<!-- /wp:spacer --></div>
<!-- /wp:group --></div>
<!-- /wp:group -->
1 change: 0 additions & 1 deletion themes/goodbids-nonprofit/templates/page.html

This file was deleted.

0 comments on commit bb4c963

Please sign in to comment.