Skip to content

Commit

Permalink
Templates: Add "in progress" template and hide content when using tem…
Browse files Browse the repository at this point in the history
…plate
  • Loading branch information
ryelle committed Nov 13, 2024
1 parent b563892 commit 9355c7d
Show file tree
Hide file tree
Showing 2 changed files with 30 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,11 @@ function( $html ) {
return $tags;
}

// Prevent content from "leaking" in embeds on pages in progress.
if ( 'page-in-progress' === get_post_meta( $post->ID, '_wp_page_template', true ) ) {
return [];
}

// These values are not correct for our page templates.
unset( $tags['article:published_time'], $tags['article:modified_time'] );

Expand Down Expand Up @@ -212,3 +217,19 @@ function() {
add_post_type_support( 'page', 'excerpt' );
}
);

/**
* Fake the `blog_public` option to prevent search engines from indexing pages in progress.
*
* This setting is used by the `wp_robots_*` functions to add noindex, nofollow meta tags.
*/
add_filter(
'pre_option_blog_public',
function( $pre ) {
global $post;
if ( $post && 'page-in-progress' === get_post_meta( $post->ID, '_wp_page_template', true ) ) {
return 0;
}
return $pre;
}
);
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
<!-- wp:wporg/global-header {"textColor":"charcoal-2","backgroundColor":"white"} /-->

<!-- wp:group {"tagName":"main","layout":{"inherit":true},"className":"entry-content","style":{"spacing":{"blockGap":"0px"}}} -->
<main class="wp-block-group entry-content">
<!-- wp:pattern {"slug":"wporg-main-2022/work-in-progress"} /-->
</main>
<!-- /wp:group -->

<!-- wp:wporg/global-footer {"textColor":"charcoal-2","backgroundColor":"white"} /-->

0 comments on commit 9355c7d

Please sign in to comment.