Skip to content

Instantly share code, notes, and snippets.

Richard Buff richardbuff

Block or report user

Report or block richardbuff

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@richardbuff
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
<?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
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
<snippet>
<content><![CDATA[
echo '<${1:div} ${2:class}="${3:value}">';
]]></content>
<description>PHP echo statement with opening html tag with class</description>
<tabTrigger>phpechohtmlopen</tabTrigger>
<scope>source.php.embedded.block.html</scope>
</snippet>
You can’t perform that action at this time.