lib
block-supports
4 months ago
compat
3 months ago
experimental
3 months ago
media
3 months ago
README.md
10.0 KB
7 months ago
block-editor-settings.php
5.4 KB
7 months ago
block-template-utils.php
3.5 KB
1 year ago
blocks.php
11.8 KB
7 months ago
class-wp-duotone-gutenberg.php
37.6 KB
5 months ago
class-wp-icons-registry-gutenberg.php
7.1 KB
4 months ago
class-wp-rest-edit-site-export-controller-gutenberg.php
1.2 KB
2 years ago
class-wp-rest-global-styles-controller-gutenberg.php
24.5 KB
7 months ago
class-wp-rest-icons-controller-gutenberg.php
481 B
4 months ago
class-wp-theme-json-data-gutenberg.php
1.7 KB
2 years ago
class-wp-theme-json-gutenberg.php
196.1 KB
3 months ago
class-wp-theme-json-resolver-gutenberg.php
34.7 KB
6 months ago
class-wp-theme-json-schema-gutenberg.php
7.4 KB
7 months ago
client-assets.php
16.4 KB
4 months ago
demo.php
1.6 KB
1 year ago
global-styles-and-settings.php
14.2 KB
7 months ago
init.php
945 B
4 months ago
interactivity-api.php
1.2 KB
7 months ago
load.php
10.9 KB
3 months ago
mathml-kses.php
6.3 KB
10 months ago
overlay-patterns.php
12.2 KB
6 months ago
remove-core-enqueue-scripts.php
779 B
5 months ago
rest-api.php
1.6 KB
4 months ago
script-loader.php
5.9 KB
5 months ago
theme-i18n.json
1.8 KB
7 months ago
theme.json
9.2 KB
5 months ago
upgrade.php
2.6 KB
5 months ago
| 1 | <?php |
| 2 | /** |
| 3 | * Supports for populating the Gutenberg demo content new post. |
| 4 | * |
| 5 | * @package gutenberg |
| 6 | */ |
| 7 | |
| 8 | if ( ! defined( 'ABSPATH' ) ) { |
| 9 | die( 'Silence is golden.' ); |
| 10 | } |
| 11 | |
| 12 | /** |
| 13 | * Redirects the demo page to edit a new post. |
| 14 | * |
| 15 | * @global string $pagenow The name of the current admin page being viewed. |
| 16 | */ |
| 17 | function gutenberg_redirect_demo() { |
| 18 | global $pagenow; |
| 19 | |
| 20 | if ( 'admin.php' === $pagenow && isset( $_GET['page'] ) && 'gutenberg' === $_GET['page'] ) { |
| 21 | wp_safe_redirect( admin_url( 'post-new.php?gutenberg-demo' ) ); |
| 22 | exit; |
| 23 | } |
| 24 | } |
| 25 | add_action( 'admin_init', 'gutenberg_redirect_demo' ); |
| 26 | |
| 27 | /** |
| 28 | * Assigns the default content for the Gutenberg demo post. |
| 29 | * |
| 30 | * @param string $content Default post content. |
| 31 | * |
| 32 | * @return string Demo content if creating a new Gutenberg demo post, or the |
| 33 | * default content otherwise. |
| 34 | */ |
| 35 | function gutenberg_default_demo_content( $content ) { |
| 36 | $is_demo = isset( $_GET['gutenberg-demo'] ); |
| 37 | |
| 38 | if ( $is_demo ) { |
| 39 | // Prepopulate with some test content in demo. |
| 40 | ob_start(); |
| 41 | include gutenberg_dir_path() . 'post-content.php'; |
| 42 | return ob_get_clean(); |
| 43 | } |
| 44 | |
| 45 | return $content; |
| 46 | } |
| 47 | add_filter( 'default_content', 'gutenberg_default_demo_content' ); |
| 48 | |
| 49 | /** |
| 50 | * Assigns the default title for the Gutenberg demo post. |
| 51 | * |
| 52 | * @param string $title Default post title. |
| 53 | * |
| 54 | * @return string Demo title if creating a new Gutenberg demo post, or the |
| 55 | * default title otherwise. |
| 56 | */ |
| 57 | function gutenberg_default_demo_title( $title ) { |
| 58 | $is_demo = isset( $_GET['gutenberg-demo'] ); |
| 59 | |
| 60 | if ( $is_demo ) { |
| 61 | return __( 'Welcome to the Gutenberg Editor', 'gutenberg' ); |
| 62 | } |
| 63 | |
| 64 | return $title; |
| 65 | } |
| 66 | add_filter( 'default_title', 'gutenberg_default_demo_title' ); |
| 67 |