Skip to content

Instantly share code, notes, and snippets.

View blogjunkie's full-sized avatar

David Wang blogjunkie

View GitHub Profile
@blogjunkie
blogjunkie / woocommerce_variation_is_active.php
Created February 1, 2021 05:55 — forked from plugin-republic/woocommerce_variation_is_active.php
Grey out variations that are out of stock for WooCommerce
/**
* Disable out of stock variations
* https://github.com/woocommerce/woocommerce/blob/826af31e1e3b6e8e5fc3c1004cc517c5c5ec25b1/includes/class-wc-product-variation.php
* @return Boolean
*/
function wcbv_variation_is_active( $active, $variation ) {
if( ! $variation->is_in_stock() ) {
return false;
}
return $active;
@blogjunkie
blogjunkie / remove-beaver-builder-from-admin-woocommerce.php
Created January 5, 2018 23:32 — forked from carasmo/remove-beaver-builder-from-admin-woocommerce.php
Remove Beaver Builder link and tab in Admin for WooCommerce pages
<?php
//* DON'T ADD ABOVE
/*
*
* READ ME:
* I'm using Beaver Builder for page post types and I don't want that option on
* WooCommerce store, cart, checkout, and my account pages. I don't want the client to ask why she can't change
@blogjunkie
blogjunkie / functions.php
Last active December 23, 2016 10:52 — forked from srikat/functions.php
Custom Shortcode to display First Category in Genesis. https://sridharkatakam.com/custom-shortcode-to-display-first-category-in-genesis/
add_shortcode( 'post_category', 'sk_post_category_shortcode' );
/**
* Produces the first category link.
*
* Supported shortcode attributes are:
* after (output after link, default is empty string),
* before (output before link, default is 'Tagged With: '),
* sep (separator string between tags, default is ', ').
*
* Output passes through 'genesis_post_categories_shortcode' filter before returning.
@blogjunkie
blogjunkie / mobile.php
Created November 23, 2016 09:23 — forked from marco-s/mobile.php
Switch between two themes, depending on what domain is used to access a site
<?php
/*
* This solution assumes you've already set up your site so that the site domain is
* your "normal" (non-mobile) domain, and your theme is your non-mobile theme.
*
* In short, what it does it check to see if the site is being accessed through the
* mobile domain. If it is, the mobile theme is used instead of the normal theme, and
* all links point to the mobile domain (so navigatiion doesn't take visitors to the
* regular domain.
@blogjunkie
blogjunkie / 0_reuse_code.js
Last active August 29, 2015 14:25
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