PluginProbe ʕ •ᴥ•ʔ
Widget Options – Advanced Conditional Visibility for Gutenberg Blocks & Classic Widgets / 4.0.7
Widget Options – Advanced Conditional Visibility for Gutenberg Blocks & Classic Widgets v4.0.7
4.2.5 4.2.4 trunk 3.7.10 3.7.11 3.7.12 3.7.13 3.7.14 3.7.2 3.7.5 3.7.6 3.7.7 3.7.8 3.7.9 3.8 3.8.1 3.8.10 3.8.2 3.8.3 3.8.4 3.8.5 3.8.6 3.8.7 3.8.8 3.8.9 3.8.9.1 3.9.0 3.9.1 3.9.2 3.9.3 3.9.4 3.9.5 3.9.6 4.0.0 4.0.1 4.0.2 4.0.3 4.0.4 4.0.5 4.0.5.1 4.0.6 4.0.6.1 4.0.7 4.0.8 4.0.9 4.1.0 4.1.1 4.1.2 4.1.3 4.2.0 4.2.1 4.2.2 4.2.3
widget-options / includes / widgets / gutenberg / lib / demo.php
widget-options / includes / widgets / gutenberg / lib Last commit date
block-supports 1 year ago compat 1 year ago experimental 1 year ago README.md 1 year ago block-editor-settings.php 1 year ago blocks.php 1 year ago class-wp-duotone-gutenberg.php 1 year ago class-wp-theme-json-data-gutenberg.php 1 year ago class-wp-theme-json-gutenberg.php 1 year ago class-wp-theme-json-resolver-gutenberg.php 1 year ago client-assets.php 1 year ago demo.php 1 year ago experiments-page.php 1 year ago global-styles-and-settings.php 1 year ago init.php 1 year ago load.php 1 year ago script-loader.php 1 year ago theme-i18n.json 1 year ago theme.json 1 year ago upgrade.php 1 year ago
demo.php
65 lines
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 function gutenberg_redirect_demo() {
16 global $pagenow;
17
18 if ( 'admin.php' === $pagenow && isset( $_GET['page'] ) && 'gutenberg' === $_GET['page'] ) {
19 wp_safe_redirect( admin_url( 'post-new.php?gutenberg-demo' ) );
20 exit;
21 }
22 }
23 add_action( 'admin_init', 'gutenberg_redirect_demo' );
24
25 /**
26 * Assigns the default content for the Gutenberg demo post.
27 *
28 * @param string $content Default post content.
29 *
30 * @return string Demo content if creating a new Gutenberg demo post, or the
31 * default content otherwise.
32 */
33 function gutenberg_default_demo_content( $content ) {
34 $is_demo = isset( $_GET['gutenberg-demo'] );
35
36 if ( $is_demo ) {
37 // Prepopulate with some test content in demo.
38 ob_start();
39 include gutenberg_dir_path() . 'post-content.php';
40 return ob_get_clean();
41 }
42
43 return $content;
44 }
45 add_filter( 'default_content', 'gutenberg_default_demo_content' );
46
47 /**
48 * Assigns the default title for the Gutenberg demo post.
49 *
50 * @param string $title Default post title.
51 *
52 * @return string Demo title if creating a new Gutenberg demo post, or the
53 * default title otherwise.
54 */
55 function gutenberg_default_demo_title( $title ) {
56 $is_demo = isset( $_GET['gutenberg-demo'] );
57
58 if ( $is_demo ) {
59 return __( 'Welcome to the Gutenberg Editor', 'gutenberg' );
60 }
61
62 return $title;
63 }
64 add_filter( 'default_title', 'gutenberg_default_demo_title' );
65