Zach Silveira was kind enough to create a video tutorial:
https://www.youtube.com/watch?v=apZwd0FqQu4&feature=youtu.be
Here are my notes as I followed along...
- Install Docker for Mac.
https://www.ibenic.com/unused-shortcodes-wordpress-code/ |
<?php | |
/** | |
* Hide shipping rates when free shipping is available. | |
* Updated to support WooCommerce 2.6 Shipping Zones. | |
* | |
* @param array $rates Array of rates found for the package. | |
* @return array | |
*/ | |
function my_hide_shipping_when_free_is_available( $rates ) { | |
$free = array(); |
<?php | |
/** | |
* Add the product's short description (excerpt) to the WooCommerce shop/category pages. The description displays after the product's name, but before the product's price. | |
* | |
* Ref: https://gist.github.com/om4james/9883140 | |
* | |
* Put this snippet into a child theme's functions.php file | |
*/ | |
function woocommerce_after_shop_loop_item_title_short_description() { | |
global $product; |
<?php | |
/** | |
* The WordPress Meme Shortcode admin page. | |
* | |
* @author Carl Alexander | |
*/ | |
class WPMemeShortcode_AdminPage | |
{ | |
/** |
<?php // only copy this line if needed | |
/** | |
* Renders a notice and prevents checkout if the cart | |
* only contains products in a specific category | |
*/ | |
function sv_wc_prevent_checkout_for_category() { | |
// set the slug of the category for which we disallow checkout | |
$category = 'clothing'; |
<?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 |
Zach Silveira was kind enough to create a video tutorial:
https://www.youtube.com/watch?v=apZwd0FqQu4&feature=youtu.be
Here are my notes as I followed along...
document.querySelectorAll('a[href^="#"]').forEach(anchor => { | |
anchor.addEventListener('click', function (e) { | |
e.preventDefault(); | |
document.querySelector(this.getAttribute('href')).scrollIntoView({ | |
behavior: 'smooth' | |
}); | |
}); | |
}); |
// License: GPLv2+ | |
var el = wp.element.createElement, | |
registerBlockType = wp.blocks.registerBlockType, | |
ServerSideRender = wp.components.ServerSideRender, | |
TextControl = wp.components.TextControl, | |
InspectorControls = wp.editor.InspectorControls; | |
/* | |
* Here's where we register the block in JavaScript. |