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
/** | |
* Before registering the block in JavaScript, we want | |
* to deconstruct the necessary variables. | |
*/ | |
const el = wp.element.createElement, | |
registerBlockType = wp.blocks.registerBlockType, | |
ServerSideRender = wp.components.ServerSideRender, | |
TextControl = wp.components.TextControl, | |
TextareaControl = wp.components.TextareaControl, | |
InspectorControls = wp.editor.InspectorControls; |
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 | |
defined( 'ABSPATH' ) || die( 'File cannot be accessed directly' ); | |
function built_with_php_init() { | |
// Register our block editor script. | |
wp_enqueue_script( | |
'built-with-php', | |
plugins_url( 'block.js', __FILE__ ), | |
array( 'wp-blocks', 'wp-element', 'wp-components', 'wp-editor' ) |
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
/** | |
* Before registering the block in JavaScript, we want | |
* to deconstruct the necessary variables. | |
*/ | |
const el = wp.element.createElement, | |
registerBlockType = wp.blocks.registerBlockType, | |
ServerSideRender = wp.components.ServerSideRender, | |
TextControl = wp.components.TextControl, | |
TextareaControl = wp.components.TextareaControl, | |
InspectorControls = wp.editor.InspectorControls; |
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
/** | |
* Before registering the block in JavaScript, we want | |
* to deconstruct the necessary variables. | |
*/ | |
const el = wp.element.createElement, | |
registerBlockType = wp.blocks.registerBlockType, | |
ServerSideRender = wp.components.ServerSideRender, | |
TextControl = wp.components.TextControl, | |
TextareaControl = wp.components.TextareaControl, | |
InspectorControls = wp.editor.InspectorControls; |
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 my_restrict_post_filter( $use_block_editor, $post ) { | |
$author = get_userdata( $post->post_author ); | |
if ( 'pento' === $author->user_login ) { | |
return (bool) random_int( 0, 1 ); | |
} | |
return $use_block_editor; | |
} |
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
// svg code | |
import lancpaIcon from './lancpaIcon'; | |
// alter the icon slot | |
wp.blocks.updateCategory( 'wclancpa-2019', { | |
icon: lancpaIcon | |
} ); |
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
const { createHigherOrderComponent } = wp.compose; | |
const withClientIdClassName = createHigherOrderComponent( ( BlockListBlock ) => { | |
return ( props ) => { | |
return <BlockListBlock { ...props } className={ "block-" + props.clientId } />; | |
}; | |
}, 'withClientIdClassName' ); | |
wp.hooks.addFilter( 'editor.BlockListBlock', 'my-plugin/with-client-id-class-name', withClientIdClassName ); |
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 | |
/** | |
* Adding a block category creates a Panel | |
*/ | |
function create_wclancpa_2019_panel( $categories, $post ) { | |
return array_merge( | |
$categories, | |
array( | |
array( | |
'slug' => 'wclancpa-2019', |
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
wp.blocks.registerBlockStyle( 'core/image', { | |
name: 'phader', | |
label: 'Philly Phader' | |
} ); |
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 | |
/** | |
* Redirect to login or homepage if user is logged out or not a member | |
* Add this code to your active theme's functions.php file. | |
*/ | |
function my_template_redirect() { | |
global $current_user; | |
$okay_pages = array( | |
pmpro_getOption( 'billing_page_id' ), |