Skip to content

Instantly share code, notes, and snippets.

View richtabor's full-sized avatar

Rich Tabor richtabor

View GitHub Profile
<?php
/**
* Title: Content-only Test
* Slug: prefix/content-only-test
*/
?>
<!-- wp:group {"templateLock": "contentOnly", "align":"wide","layout":{"type":"constrained","wideSize":"2000px"}} -->
<div class="wp-block-group alignwide"><!-- wp:columns -->
<div class="wp-block-columns"><!-- wp:column -->
<div class="wp-block-column"><!-- wp:image {"id":231,"sizeSlug":"large","linkDestination":"none"} -->
<!-- wp:group {"align":"full","backgroundColor":"orange","textColor":"black"} -->
<div class="wp-block-group alignfull has-black-color has-orange-background-color has-text-color has-background"><div class="wp-block-group__inner-container"><!-- wp:columns {"align":"wide"} -->
<div class="wp-block-columns alignwide"><!-- wp:column -->
<div class="wp-block-column"><!-- wp:paragraph {"fontSize":"huge"} -->
<p class="has-huge-font-size">1</p>
<!-- /wp:paragraph -->
<!-- wp:heading {"level":3,"fontSize":"extra-large"} -->
<h3 class="has-extra-large-font-size">Create</h3>
<!-- /wp:heading -->
/**
* Block Editor Settings.
* Add custom colors and gradients to the editor.
*/
function tabor_add_colors_and_gradients() {
$colors = array(
'primary' => '#db1c7d',
'secondary' => '#a528f0',
'tertiary' => '#90cbff',
function tabor_register_block_categories() {
if ( class_exists( 'WP_Block_Patterns_Registry' ) ) {
register_block_pattern_category(
'hero',
array( 'label' => _x( 'Hero', 'Block pattern category', 'textdomain' ) )
);
}
}
function block_variation_example_enqueue() {
wp_enqueue_script(
'block-variation-example-script',
plugins_url( 'index.js', __FILE__ ),
array( 'wp-blocks', 'wp-dom-ready', 'wp-edit-post' ),
filemtime( plugin_dir_path( __FILE__ ) . '/block-variation-example.js' )
);
}
add_action( 'enqueue_block_editor_assets', 'block_variation_example_enqueue' );
wp.domReady( function() {
wp.blocks.registerBlockVariation( 'coblocks/form', {
name: 'event-registration',
title: 'Event Registration',
icon: '<svg height="48" viewBox="0 0 48 48" width="48" xmlns="http://www.w3.org/2000/svg"><path d="m18 10h-14v2h14zm2-8h-1v-2h-2v2h-12v-2h-2v2h-1c-1.11 0-1.99.9-1.99 2l-.01 16c0 1.1.89 2 2 2h18c1.1 0 2-.9 2-2v-16c0-1.1-.9-2-2-2zm0 18h-18v-13h18zm-5-5h-6-5v2h11z" transform="translate(13 14)"/></svg>',
innerBlocks: [
[ 'coblocks/field-name', { label: 'Full name', hasLastName: true } ],
[ 'coblocks/field-email', { required: true } ],
[ 'coblocks/field-radio', { label: 'How do you use WordPress?', required: true, options: [ 'I write', 'I design', 'I develop', 'I manage', 'I am new to WordPress!'] } ],
[ 'coblocks/field-checkbox', { label: 'I’m on a gluten-free diet', options: [ 'Yes', 'No' ], required: true } ],
--body-bg-color: #e0ded5
--body-color: #433f40
body {
background-color: var(--body-bg-color, #fff);
color: var(--body-color, #000);
}
<?php
if ( has_block( 'blockgallery/masonry' ) ) {
// Do something, if the Block Gallery Masonry block is added to this page.
}
@richtabor
richtabor / function.php
Last active January 4, 2019 17:01 — forked from deeman/function.php
WooCommerce. Single product. Remove Additional Information
/**
* Modify 'More Information' tab.
*/
function ava_child_product_additional_information_heading() {
return __( 'More Stuff', 'ava' );
}
add_filter('woocommerce_product_additional_information_heading', 'ava_child_product_additional_information_heading');
// Enqueue fonts in the editor.
add_editor_style( york_fonts_url() );}