Skip to content

Instantly share code, notes, and snippets.

@colorful-tones
Created August 2, 2022 21:48
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save colorful-tones/4aa8fab606aa683c3d16ca814f8c75ae to your computer and use it in GitHub Desktop.
Save colorful-tones/4aa8fab606aa683c3d16ca814f8c75ae to your computer and use it in GitHub Desktop.
<!-- wp:template-part {"slug":"header","tagName":"header","className":"site-header"} /-->
<!-- wp:group {"tagName":"main","className":"site-content","style":{"spacing":{"margin":{"top":"0"}}}} -->
<main class="wp-block-group site-content" style="margin-top:0">
<!-- wp:pattern {"slug":"frost/page-home"} /-->
</main>
<!-- /wp:group -->
<!-- wp:template-part {"slug":"footer","tagName":"footer","className":"site-footer"} /-->
<?php
/**
* Title: Sample home page.
* Slug: frost/page-home
* Categories: frost-page
* Viewport Width: 1280
*/
$has_static_page = get_option( 'page_on_front' );
?>
<?php if ( ! $has_static_page ) : ?>
<!-- wp:paragraph -->
<p><?php echo esc_html__( 'Front page', 'frost' ); ?></p>
<!-- /wp:paragraph -->
<?php else : ?>
<!-- wp:paragraph -->
<p><?php echo esc_html__( 'Other', 'frost' ); ?></p>
<!-- /wp:paragraph -->
<?php endif; ?>
@colorful-tones
Copy link
Author

These files would go in the corresponding directories:

  • patterns/page-home.php - has a conditional check for get_option( 'page_on_front' ); which loads different content based on response.
  • templates/front-page.html - references and loads the patterns/page-home.php.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment