Skip to content

Commit

Permalink
Add initial page templates with header and footer
Browse files Browse the repository at this point in the history
Local nav includes log in link when logged out.

See #1
See WordPress/wporg-mu-plugins#647
  • Loading branch information
adamwoodnz committed Sep 29, 2024
1 parent 49c1ef6 commit 18808b8
Show file tree
Hide file tree
Showing 7 changed files with 197 additions and 3 deletions.
44 changes: 44 additions & 0 deletions source/wp-content/themes/wporg-make-2024/functions.php
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
<?php

add_filter( 'wporg_block_navigation_menus', 'add_site_navigation_menus' );

/**
* Enqueue theme styles.
*/
Expand Down Expand Up @@ -43,6 +45,48 @@ function make_setup_theme() {
}
add_action( 'after_setup_theme', 'make_setup_theme' );

/**
* Provide a list of local navigation menus.
*/
function add_site_navigation_menus( $menus ) {
$menu = array(
array(
'label' => __( 'Meetings', 'make-wporg' ),
'url' => site_url( '/meetings/' ),
),
array(
'label' => __( 'Team Updates', 'make-wporg' ),
'url' => site_url( '/updates/' ),
),
array(
'label' => __( 'Project Updates', 'make-wporg' ),
'url' => site_url( '/project/' ),
),
array(
'label' => __( 'Five for the Future', 'make-wporg' ),
'url' => 'https://wordpress.org/five-for-the-future/',
),
array(
'label' => __( 'Contributor Handbook', 'make-wporg' ),
'url' => site_url( '/handbook/' ),
),
);

if ( ! is_user_logged_in() ) {
global $wp;
$redirect_url = home_url( $wp->request );
$menu[] = array(
'label' => __( 'Log in', 'make-wporg' ),
'url' => wp_login_url( $redirect_url ),
'className' => 'has-separator',
);
}

$menus['make'] = $menu;

return $menus;
}

/**
* Modify the main query on the home and search pages.
*
Expand Down
4 changes: 3 additions & 1 deletion source/wp-content/themes/wporg-make-2024/parts/footer.html
Original file line number Diff line number Diff line change
@@ -1 +1,3 @@
<!-- wp:wporg/global-footer /-->
<!-- wp:pattern {"slug":"wporg-make-2024/footer-content"} /-->

<!-- wp:wporg/global-footer {"tagName":"div"} /-->
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
<?php
/**
* Title: Footer Content
* Slug: wporg-make-2024/footer-content
* Inserter: no
*/

?>

<!-- wp:group {"align":"full","style":{"spacing":{"padding":{"right":"var:preset|spacing|edge-space","left":"var:preset|spacing|edge-space","top":"var:preset|spacing|40","bottom":"var:preset|spacing|40"}},"border":{"bottom":{"color":"var:preset|color|white-opacity-15","style":"solid","width":"1px"}},"elements":{"link":{"color":{"text":"var:preset|color|white"}}}},"backgroundColor":"charcoal-2","textColor":"white","className":"wporg-front-page-footer","layout":{"type":"constrained"}} -->
<div class="wp-block-group alignfull wporg-front-page-footer has-white-color has-charcoal-2-background-color has-text-color has-background has-link-color" style="border-bottom-color:var(--wp--preset--color--white-opacity-15);border-bottom-style:solid;border-bottom-width:1px;padding-top:var(--wp--preset--spacing--40);padding-right:var(--wp--preset--spacing--edge-space);padding-bottom:var(--wp--preset--spacing--40);padding-left:var(--wp--preset--spacing--edge-space)">

<!-- wp:columns {"align":"wide","style":{"spacing":{"blockGap":{"top":"var:preset|spacing|20"}}},"className":"is-style-default"} -->
<div class="wp-block-columns alignwide is-style-default">

<!-- wp:column {"verticalAlignment":"top","width":"50%","className":"is-left-column","layout":{"inherit":false}} -->
<div class="wp-block-column is-vertically-aligned-top is-left-column" style="flex-basis:50%">

<!-- wp:heading {"style":{"typography":{"fontStyle":"normal","fontWeight":"600","lineHeight":"1.3"}},"fontSize":"heading-5"} -->
<h2 class="wp-block-heading has-heading-5-font-size" style="font-style:normal;font-weight:600;line-height:1.3"><?php esc_html_e( 'More resources', 'make-wporg' ); ?></h2>
<!-- /wp:heading -->

<!-- wp:columns {"style":{"spacing":{"blockGap":{"left":"var:preset|spacing|50"}}}} -->
<div class="wp-block-columns">

<!-- wp:column {"style":{"spacing":{"blockGap":"var:preset|spacing|10"}}} -->
<div class="wp-block-column">

<!-- wp:heading {"level":3,"style":{"typography":{"fontStyle":"normal","fontWeight":"700","lineHeight":1.6},"elements":{"link":{"color":{"text":"var:preset|color|blueberry-2"}}}},"textColor":"blueberry-2","className":"is-style-short-text","fontSize":"normal","fontFamily":"inter"} -->
<h3 class="wp-block-heading is-style-short-text has-blueberry-2-color has-text-color has-link-color has-inter-font-family has-normal-font-size" style="font-style:normal;font-weight:700;line-height:1.6"><a href="https://make.wordpress.org/docs/handbook/"><?php esc_html_e( 'Five for the Future', 'make-wporg' ); ?></a></h3>
<!-- /wp:heading -->

<!-- wp:paragraph -->
<p><?php esc_html_e( 'Contribute 5% back.', 'make-wporg' ); ?></p>
<!-- /wp:paragraph -->

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

<!-- wp:column {"style":{"spacing":{"blockGap":"var:preset|spacing|10"}}} -->
<div class="wp-block-column">

<!-- wp:heading {"level":3,"style":{"typography":{"fontStyle":"normal","fontWeight":"700","lineHeight":1.6},"elements":{"link":{"color":{"text":"var:preset|color|blueberry-2"}}}},"textColor":"blueberry-2","className":"is-style-short-text","fontSize":"normal","fontFamily":"inter"} -->
<h3 class="wp-block-heading is-style-short-text has-blueberry-2-color has-text-color has-link-color has-inter-font-family has-normal-font-size" style="font-style:normal;font-weight:700;line-height:1.6"><a href="https://make.wordpress.org/core/handbook/"><?php esc_html_e( 'Contributor Handbook', 'make-wporg' ); ?></a></h3>
<!-- /wp:heading -->

<!-- wp:paragraph -->
<p><?php esc_html_e( 'Get started.', 'make-wporg' ); ?></p>
<!-- /wp:paragraph -->

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

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

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

<!-- wp:column {"width":"50%","layout":{"inherit":false}} -->
<div class="wp-block-column" style="flex-basis:50%">

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

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

</div><!-- /wp:group -->
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
<?php
/**
* Title: Front Page Header
* Slug: wporg-make-2024/front-page-header
* Inserter: no
*/

?>

<!-- wp:wporg/global-header {"style":{"border":{"bottom":{"color":"var:preset|color|white-opacity-15","style":"solid","width":"1px"}}}} /-->

<!-- wp:wporg/local-navigation-bar {"backgroundColor":"charcoal-2","style":{"elements":{"link":{"color":{"text":"var:preset|color|white"},":hover":{"color":{"text":"var:preset|color|white"}}}}},"textColor":"white","fontSize":"small"} -->

<!-- wp:site-title {"level":0,"fontSize":"small","className":"wporg-local-navigation-bar__show-on-scroll"} /-->

<!-- wp:navigation {"icon":"menu","overlayBackgroundColor":"charcoal-1","overlayTextColor":"white","layout":{"type":"flex","orientation":"horizontal"},"fontSize":"small","menuSlug":"make"} /-->

<!-- /wp:wporg/local-navigation-bar -->

<!-- wp:group {"align":"full","style":{"spacing":{"padding":{"right":"var:preset|spacing|edge-space","left":"var:preset|spacing|edge-space"}}},"backgroundColor":"charcoal-2","className":"has-white-color has-charcoal-2-background-color has-text-color has-background has-link-color","layout":{"type":"constrained"}} -->
<div class="wp-block-group alignfull has-white-color has-charcoal-2-background-color has-text-color has-background has-link-color" style="padding-right:var(--wp--preset--spacing--edge-space);padding-left:var(--wp--preset--spacing--edge-space)">

<!-- wp:group {"align":"wide","style":{"spacing":{"padding":{"top":"var:preset|spacing|40","bottom":"var:preset|spacing|30"},"blockGap":"var:preset|spacing|30"}},"layout":{"type":"flex","flexWrap":"wrap","verticalAlignment":"bottom"}} -->
<div class="wp-block-group alignwide" style="padding-top:var(--wp--preset--spacing--40);padding-bottom:var(--wp--preset--spacing--30)">

<!-- wp:heading {"level":1,"style":{"typography":{"fontSize":"50px"}}} -->
<h1 class="wp-block-heading" style="font-size:50px"><?php esc_html_e( 'Make WordPress', 'make-wporg' ); ?></h1>
<!-- /wp:heading -->

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

</div>
<!-- /wp:group -->
17 changes: 17 additions & 0 deletions source/wp-content/themes/wporg-make-2024/templates/front-page.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
<!-- wp:pattern {"slug":"wporg-make-2024/front-page-header"} /-->

<!-- wp:group {"tagName":"main","layout":{"type":"constrained"},"className":"entry-content","style":{"spacing":{"blockGap":"0px"}}} -->
<main class="wp-block-group entry-content">

<!-- wp:group {"align":"full","style":{"spacing":{"padding":{"left":"var:preset|spacing|edge-space","right":"var:preset|spacing|edge-space","top":"var:preset|spacing|20","bottom":"var:preset|spacing|60"}}},"layout":{"type":"constrained"}} -->
<div class="wp-block-group alignfull" style="padding-top:var(--wp--preset--spacing--20);padding-right:var(--wp--preset--spacing--edge-space);padding-left:var(--wp--preset--spacing--edge-space);padding-bottom:var(--wp--preset--spacing--60)">

<!-- wp:pattern {"slug":"wporg-make-2024/front-page-content"} /-->

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

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

<!-- wp:template-part {"slug":"footer"} /-->
19 changes: 19 additions & 0 deletions source/wp-content/themes/wporg-make-2024/templates/page.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
<!-- wp:template-part {"slug":"header"} /-->

<!-- wp:group {"tagName":"main","layout":{"type":"constrained"},"className":"entry-content","style":{"spacing":{"blockGap":"0px"}}} -->
<main class="wp-block-group entry-content">

<!-- wp:group {"align":"full","style":{"spacing":{"padding":{"left":"var:preset|spacing|edge-space","right":"var:preset|spacing|edge-space","top":"var:preset|spacing|20","bottom":"var:preset|spacing|60"}}},"layout":{"type":"constrained"}} -->
<div class="wp-block-group alignfull" style="padding-top:var(--wp--preset--spacing--20);padding-right:var(--wp--preset--spacing--edge-space);padding-left:var(--wp--preset--spacing--edge-space);padding-bottom:var(--wp--preset--spacing--60)">

<!-- wp:post-title {"level":1,"style":{"spacing":{"margin":{"bottom":"var:preset|spacing|30"}}}} /-->

<!-- wp:post-content {"layout":{"inherit":true}} /-->

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

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

<!-- wp:template-part {"slug":"footer"} /-->
15 changes: 13 additions & 2 deletions source/wp-content/themes/wporg-make-2024/theme.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,10 @@
},
"level-1": {
"typography": {
"lineHeight": 1.2
"fontFamily": "var(--wp--preset--font-family--eb-garamond)",
"fontSize": "36px",
"lineHeight": 1.3,
"fontWeight": 400
},
"breakpoint": {
"small-only": {
Expand Down Expand Up @@ -89,7 +92,7 @@
}
},
"layout": {
"contentSize": "960px"
"contentSize": "1160px"
},
"typography": {
"fontSizes": [
Expand Down Expand Up @@ -144,6 +147,14 @@
}
},
"elements": {
"h1": {
"typography": {
"fontFamily": "var(--wp--custom--heading--level-1--typography--font-family)",
"fontSize": "var(--wp--custom--heading--level-1--typography--font-size)",
"lineHeight": "var(--wp--custom--heading--level-1--typography--line-height)",
"fontWeight": "var(--wp--custom--heading--level-1--typography--font-weight)"
}
},
"h2": {
"typography": {
"fontSize": "var(--wp--preset--font-size--heading-4)",
Expand Down

0 comments on commit 18808b8

Please sign in to comment.