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 mytheme_setup_theme_supported_features() { | |
add_theme_support( 'editor-color-palette', | |
'#556270', | |
'#4ECDC4', | |
'#C7F464', | |
'#FF6B6B', | |
'#C44D58', | |
); |
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 mytheme_block_templates( $args, $post_type ) { | |
// Only add template to 'post' post type | |
// Change for your post type: eg 'page', 'event', 'product' | |
if ( 'post' == $post_type ) { | |
// Optionally lock templates from further changes | |
// Change to 'insert' to allow adding other blocks, but lock defined blocks |
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 | |
/** | |
* Enqueue block styles on frontend and in editor | |
* | |
*/ | |
function mytheme_block_styles() { | |
wp_enqueue_style( 'mytheme-blocks', get_stylesheet_directory_uri() . '/css/blocks.css' ); |
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 | |
/** | |
* Enqueue block editor CSS | |
*/ | |
function jsforwpblocks_editor_scripts() { | |
// Make paths variables so we don't write em twice ;) | |
$editorStylePath = '/assets/css/blocks.editor.css'; |
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 | |
/** | |
* Enqueue block editor JavaScript and CSS | |
*/ | |
function jsforwpblocks_editor_scripts() { | |
// Make paths variables so we don't write em twice ;) | |
$blockPath = '/assets/js/blocks.js'; | |
$editorStylePath = '/assets/css/blocks.editor.css'; |
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 path = require( 'path' ); | |
const webpack = require( 'webpack' ); | |
const ExtractTextPlugin = require( 'extract-text-webpack-plugin' ); | |
// Set different CSS extraction for editor only and common block styles | |
const blocksCSSPlugin = new ExtractTextPlugin( { | |
filename: './assets/css/blocks.style.css', | |
} ); | |
const editBlocksCSSPlugin = new ExtractTextPlugin( { | |
filename: './assets/css/blocks.editor.css', |
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 | |
/** | |
* Enqueue block-name main JavaScript file for the editor | |
*/ | |
function js4wp_block_name_enqueue_scripts() { | |
// Make path a variable so we don't write it twice ;) | |
$blockPath = '/blocks/block-name/index.js'; | |
NewerOlder