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
{ | |
"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": { |
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
<article class="post"> | |
<h2 class="entry-title"><a href="#">Title</a></h2> | |
<div class="entry-excerpt"> | |
<p>Excerpt here...</p> | |
</div> | |
</article> |
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 | |
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; | |
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 wpvipblocks_templates( $args, $post_type ) { | |
if ( $post_type == 'post' ) { | |
$args['template_lock'] = true; | |
$args['template'] = [ | |
[ | |
'core/heading', [ | |
'placeholder' => 'Add heading here.', |
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
<!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"> |
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
// 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"; |
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
/** | |
* 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.. |
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
{ | |
"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" | |
], |
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
{ | |
"presets": [ "@wordpress/default" ], | |
"plugins": [ | |
"transform-object-rest-spread", | |
[ | |
"transform-react-jsx", | |
{ | |
"pragma": "wp.element.createElement" | |
} | |
], |
NewerOlder