diff --git a/blank-canvas/functions.php b/blank-canvas/functions.php index 114330ba3..51f2ea172 100755 --- a/blank-canvas/functions.php +++ b/blank-canvas/functions.php @@ -176,3 +176,27 @@ add_action( 'customize_controls_enqueue_scripts', 'blank_canvas_customizer_enque * Customizer additions. */ require get_stylesheet_directory() . '/inc/customizer.php'; + +/** + * Adds custom classes to the array of body classes. + * + * @param array $classes Classes for the body element. + * @return array + */ +function blank_canvas_body_classes( $classes ) { + + if ( false === get_theme_mod( 'show_post_and_page_titles', false ) ) { + $classes[] = 'hide-post-and-page-titles'; + } + + if ( false === get_theme_mod( 'show_site_footer', false ) ) { + $classes[] = 'hide-site-footer'; + } + + if ( false === get_theme_mod( 'show_comments', false ) ) { + $classes[] = 'hide-comments'; + } + + return $classes; +} +add_filter( 'body_class', 'blank_canvas_body_classes' ); diff --git a/blank-canvas/style.css b/blank-canvas/style.css index e04509fc0..8c2b3d237 100644 --- a/blank-canvas/style.css +++ b/blank-canvas/style.css @@ -78,3 +78,29 @@ Used as block pattern image. .footer-menu { text-align: center; } + +/* Remove some top padding if the first block on the page is a full-width image, cover, media & text, or group block. */ + +.single.hide-post-and-page-titles .entry-content > .wp-block-image.alignfull:first-child, +.page.hide-post-and-page-titles .entry-content > .wp-block-image.alignfull:first-child, +.single.hide-post-and-page-titles .entry-content > .wp-block-cover.alignfull:first-child, +.page.hide-post-and-page-titles .entry-content > .wp-block-cover.alignfull:first-child, +.single.hide-post-and-page-titles .entry-content > .wp-block-media-text.alignfull:first-child, +.page.hide-post-and-page-titles .entry-content > .wp-block-media-text.alignfull:first-child, +.single.hide-post-and-page-titles .entry-content > .wp-block-group.has-background.alignfull:first-child, +.page.hide-post-and-page-titles .entry-content > .wp-block-group.has-background.alignfull:first-child { + margin-top: calc(-1 * var(--global--spacing-vertical)); +} + +/* Remove some bottom padding if the last block on the page is a full-width image, cover, media & text, or group block. */ + +.page.hide-site-footer .entry-content > .wp-block-image.alignfull:last-child, +.page.hide-site-footer .entry-content > .wp-block-cover.alignfull:last-child, +.page.hide-site-footer .entry-content > .wp-block-media-text.alignfull:last-child, +.single.hide-site-footer.hide-site-footer .entry-content > .wp-block-group.has-background.alignfull:last-child, +.single.hide-site-footer.hide-comments .entry-content > .wp-block-image.alignfull:last-child, +.single.hide-site-footer.hide-comments .entry-content > .wp-block-cover.alignfull:last-child, +.single.hide-site-footer.hide-comments .entry-content > .wp-block-media-text.alignfull:last-child, +.single.hide-site-footer.hide-comments .entry-content > .wp-block-group.has-background.alignfull:last-child { + margin-bottom: calc(-1 * var(--global--spacing-vertical)); +} diff --git a/blank-canvas/template-parts/content/content-singular.php b/blank-canvas/template-parts/content/content-singular.php index 2238e1341..1aa210a8f 100644 --- a/blank-canvas/template-parts/content/content-singular.php +++ b/blank-canvas/template-parts/content/content-singular.php @@ -26,11 +26,7 @@ $show_post_and_page_titles = get_theme_mod( 'show_post_and_page_titles', false ) -