Skip to content

Instantly share code, notes, and snippets.

@ankitsingh101
ankitsingh101 / 0_reuse_code.js
Created May 8, 2017 03:54
Here are some things you can do with Gists in GistBox.
// Use Gists to store code you would like to remember later on
console.log(window); // log the "window" object to the console
import './editor.scss';
import './style.scss';
const { __ } = wp.i18n; // Import __() from wp.i18n
const { registerBlockType } = wp.blocks; // Import registerBlockType() from wp.blocks
const { InnerBlocks } = wp.blockEditor;
const TEMPLATE = [
['core/heading', { placeholder: 'Recipe Title' }],
@ankitsingh101
ankitsingh101 / functions.php
Created April 28, 2020 07:22 — forked from hirejordansmith/functions.php
Add support for ACF custom fields to WooCommerce Attributes
<?php
// Adds a custom rule type.
add_filter( 'acf/location/rule_types', function( $choices ){
$choices[ __("Other",'acf') ]['wc_prod_attr'] = 'WC Product Attribute';
return $choices;
} );
// Adds custom rule values.
add_filter( 'acf/location/rule_values/wc_prod_attr', function( $choices ){