-
Notifications
You must be signed in to change notification settings - Fork 4.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
56 changed files
with
763 additions
and
403 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
<?php | ||
/** | ||
* Bootstraps the new posts dashboard page. | ||
* | ||
* @package Gutenberg | ||
*/ | ||
|
||
add_action( 'admin_menu', 'gutenberg_replace_posts_dashboard' ); | ||
|
||
/** | ||
* Renders the new posts dashboard page. | ||
*/ | ||
function gutenberg_posts_dashboard() { | ||
wp_register_style( | ||
'wp-gutenberg-posts-dashboard', | ||
gutenberg_url( 'build/edit-site/posts.css', __FILE__ ), | ||
array() | ||
); | ||
wp_enqueue_style( 'wp-gutenberg-posts-dashboard' ); | ||
wp_add_inline_script( 'wp-edit-site', 'window.wp.editSite.initializePostsDashboard( "gutenberg-posts-dashboard" );', 'after' ); | ||
wp_enqueue_script( 'wp-edit-site' ); | ||
|
||
echo '<div id="gutenberg-posts-dashboard"></div>'; | ||
} | ||
|
||
/** | ||
* Replaces the default posts menu item with the new posts dashboard. | ||
*/ | ||
function gutenberg_replace_posts_dashboard() { | ||
$gutenberg_experiments = get_option( 'gutenberg-experiments' ); | ||
if ( ! $gutenberg_experiments || ! array_key_exists( 'gutenberg-new-posts-dashboard', $gutenberg_experiments ) || ! $gutenberg_experiments['gutenberg-new-posts-dashboard'] ) { | ||
return; | ||
} | ||
$ptype_obj = get_post_type_object( 'post' ); | ||
add_submenu_page( | ||
'gutenberg', | ||
$ptype_obj->labels->name, | ||
$ptype_obj->labels->name, | ||
'edit_posts', | ||
'gutenberg-posts-dashboard', | ||
'gutenberg_posts_dashboard' | ||
); | ||
} |
Oops, something went wrong.