Last active
March 25, 2018 15:43
-
-
Save dartiss/045b5c0aa06ab6d16b21226e63164704 to your computer and use it in GitHub Desktop.
Add Gutenberg promo to the site of WordPress posts
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
<?php | |
function add_gutenberg_promo( $content ) { | |
global $post; | |
if ( function_exists( 'gutenberg_post_has_blocks' ) && gutenberg_post_has_blocks( $post->ID ) && is_single() ) { | |
$content = '<div style="background:#fff8c4; border:1px solid #f2c779; border-radius:10px; padding:10px; margin-bottom:10px;">This post was created using Gutenberg, the new editor, coming soon, for WordPress. You can <a href="https://wordpress.org/gutenberg/">learn more about it here</a>, <a href="https://wordpress.org/plugins/gutenberg/">try the Beta plugin</a> or simply <a href="https://testgutenberg.com">try it out for yourself</a>, no site required.</div>' . $content; | |
} | |
return $content; | |
} | |
add_filter( 'the_content', 'add_gutenberg_promo' ); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add to your theme's
functions.php
file to add a promotional message about Gutenberg to the top of your posts.