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
/** | |
* Add a menu for the block editor | |
*/ | |
function add_block_menu() { | |
add_menu_page( | |
'Reusable Blocks', | |
'Reusable Blocks', | |
'manage_options', | |
'edit.php?post_type=wp_block', |
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 | |
/** | |
* WordPress fork detection | |
* | |
* Check if a WordPress fork is in use. The check is a seperate function, instead of simply using the current function_exists | |
* in case the method of detection needs to change. | |
*/ | |
function is_fork() { | |
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 | |
/* | |
Plugin Name: Artiss.blog Configuration | |
Plugin URI: https://artiss.blog | |
Description: Configuration Settings for Artiss.blog | |
Author: David Artiss | |
Author URI: https://artiss.blog | |
*/ |
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
remove_action( 'try_gutenberg_panel', 'wp_try_gutenberg_panel' ); |
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 check_php_level() { | |
$php = '[[your minimum PHP level]]'; // Minimum PHP level required | |
/* translators: %1$s: required PHP version, %2$s: current PHP level */ | |
$message = sprintf( __( 'The [[your plugin name]] plugin requires PHP version %1$s or greater but you are using version %2$s. The plugin has NOT been activated.', '[[your text-domain]]' ), $php, PHP_VERSION ); | |
$title = __( 'Plugin Activation Error', '[[your text-domain]]' ); | |
if ( version_compare( PHP_VERSION, $php, '<' ) ) { |
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 is_gutenberg() { | |
global $post; | |
if ( function_exists( 'gutenberg_post_has_blocks' ) && gutenberg_post_has_blocks( $post->ID ) { | |
return true; | |
} else { | |
return false; | |
} |
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 | |
/* | |
Plugin Name: Plugin Example | |
Description: An example plugin | |
Version: 1.0 | |
Author: [Your name] | |
Author URI: [Your website] | |
*/ |
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 embed_code( $content ) { | |
global $post; | |
$i = 1; | |
while ( $i < 6 ) { | |
$code = 'CODE' . $i; |
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; | |
} |