Skip to content

Commit

Permalink
Boost: Add "Foundation Page" state in WP's page listing scree (#39878)
Browse files Browse the repository at this point in the history
* Add indication if a page is a foundation page in WPs page listing

* add changelog
  • Loading branch information
dilirity authored Oct 23, 2024
1 parent 369c665 commit bcc3a51
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 0 deletions.
15 changes: 15 additions & 0 deletions projects/plugins/boost/app/lib/Foundation_Pages.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ public function setup() {
}

add_filter( 'jetpack_boost_critical_css_providers', array( $this, 'remove_ccss_front_page_provider' ), 10, 2 );
add_filter( 'display_post_states', array( $this, 'add_display_post_states' ), 10, 2 );
}

public function remove_ccss_front_page_provider( $providers ) {
Expand Down Expand Up @@ -41,6 +42,20 @@ public function get_properties() {
);
}

public function add_display_post_states( $post_states, $post ) {
$foundation_pages = $this->get_pages();
if ( ! empty( $foundation_pages ) ) {
$post_url = untrailingslashit( get_permalink( $post ) );
$foundation_pages = array_map( 'untrailingslashit', $foundation_pages );

if ( in_array( $post_url, $foundation_pages, true ) ) {
$post_states[] = __( 'Foundation Page', 'jetpack-boost' );
}
}

return $post_states;
}

private function get_max_pages() {
return Premium_Features::has_any() ? 10 : 1;
}
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
Significance: patch
Type: added
Comment: Add "Foundation Page" indication next to pages in WPs page listing screen.


0 comments on commit bcc3a51

Please sign in to comment.