Skip to content

Instantly share code, notes, and snippets.


Richard Buff richardbuff

View GitHub Profile
richardbuff / wc-set-all-ancestor-categories-for-product.php
Last active Jun 6, 2018
WP-CLI - Set all parent / ancestor categories for a WooCommerce product - WP-CLI custom command
View wc-set-all-ancestor-categories-for-product.php
// If a child category for WooCommerce Product is set, but the parent/grandparent/etc category is not set,
// running this will also set all the ancestor categories (parent, grandparent, etc...)
if ( defined('WP_CLI') && WP_CLI ) { //Check to make sure WP_CLI is running. This way our code isn't loaded on normal site visits.
* Class EA_Set_All_Ancestor_Cats_For_A_Product
class EA_Set_All_Ancestor_Cats_For_A_Product extends WP_CLI_Command {
richardbuff / gist:ca05441197668ae28b68
Last active Aug 29, 2015
Sublime Snippets For PHP echo of HTML opening and closing tags
View gist:ca05441197668ae28b68
// Save as: php-echo-open-html.sublime-snippet
echo '<${1:div} ${2:class}="${3:value}">';
<description>PHP echo statement with opening html tag with class</description>
You can’t perform that action at this time.