View package.json
{ | |
"name": "cta-block-example", | |
"version": "1.0.0", | |
"license": "MIT", | |
"main": "blocks/index.js", | |
"scripts": { | |
"dev": "cross-env BABEL_ENV=default webpack --watch", | |
"build": "cross-env BABEL_ENV=default NODE_ENV=production webpack -p" | |
}, | |
"devDependencies": { |
View webpack.config.js
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', |
View article.html
<article class="post"> | |
<h2 class="entry-title"><a href="#">Title</a></h2> | |
<div class="entry-excerpt"> | |
<p>Excerpt here...</p> | |
</div> | |
</article> |
View gravityforms-learndash-groups.php
<?php | |
add_action( 'gform_activate_user', 'apply_learndash_group', 10, 3 ); | |
function apply_learndash_group( $user_id, $user_data ) { | |
// Change to be group ID for your group | |
$group_id = XXXX; | |
View gutenberg-block-tempalte-example.php
<?php | |
function wpvipblocks_templates( $args, $post_type ) { | |
if ( $post_type == 'post' ) { | |
$args['template_lock'] = true; | |
$args['template'] = [ | |
[ | |
'core/heading', [ | |
'placeholder' => 'Add heading here.', |
View react-book-ch3-react-object.html
<!DOCTYPE html> | |
<html> | |
<head> | |
<title>Core React Library</title> | |
</head> | |
<body> | |
</body> | |
<script crossorigin src="https://unpkg.com/react@16/umd/react.development.js"></script> | |
<script type="text/javascript"> |
View import-using-alias.js
// Example of how to deconstruct registerBlockType without externals | |
const { registerBlockType } = wp.blocks; | |
// Example of how to import wp.blocks using webpack externals | |
import { registerBlockType } from "@wordpress/blocks"; |
View gutenberg-webpack-config-with-externals.js
/** | |
* External dependencies | |
*/ | |
// Load webpack for use of certain webpack tools and methods | |
const webpack = require( 'webpack' ); | |
// For extracting CSS (and SASS) into separate files | |
const ExtractTextPlugin = require( 'extract-text-webpack-plugin' ); | |
// Main CSS loader for everything but blocks.. |
View gutenberg-package.json
{ | |
"name": "ex6-events", | |
"version": "1.0.0", | |
"scripts": { | |
"build": "cross-env BABEL_ENV=default NODE_ENV=production webpack", | |
"dev": "cross-env BABEL_ENV=default webpack --watch" | |
}, | |
"browserslist": [ | |
"extends @wordpress/browserslist-config" | |
], |
View gutenberg-babelrc
{ | |
"presets": [ "@wordpress/default" ], | |
"plugins": [ | |
"transform-object-rest-spread", | |
[ | |
"transform-react-jsx", | |
{ | |
"pragma": "wp.element.createElement" | |
} | |
], |
NewerOlder