Skip to content

Instantly share code, notes, and snippets.

@helgatheviking
helgatheviking / nav-menu-roles-toggle.php
Last active September 3, 2025 21:07
Give Nav Menu Roles priority over any competing Walkers
<?php
/**
* Plugin Name: Nav Menu Roles Toggle
* Plugin URI: https://gist.github.com/helgatheviking/d00f9c033a4b0aab0f69cf50d7dcd89c
* Description: Disable any competing/incompatible Walkers
* Version: 0.3.0
* Author: helgatheviking
* Author URI: http://kathyisawesome.com
*/
@helgatheviking
helgatheviking / wc-mnm-alphabetical-sorting.php
Last active October 1, 2023 20:29
Sort Mix and Match children alphabetically
<?php
/**
* Sort the mix and match children alphabetically
*
* @param array $children : an array of $product objects
* @param obj $product : the container product
* @return array
*/
function mnm_order_children_args( $children, $product ){
@helgatheviking
helgatheviking / sortable-select2.php
Last active December 1, 2021 04:34
Add drag and drop sorting to WooCommerce enhanced product select
<?php
/**
* Plugin Name: WooCommerce Sortable Enhanced Product Search
* Plugin URI: https://gist.github.com/helgatheviking/279ebd34b1e4de7e2380ca3b9936e9c4
* Description: Sort enhanced product search via drag and drop, ideal for Mix and Match, Bundles, etc
* Version: 1.0.0b
* Author: Kathy Darling
* Author URI: http://kathyisawesome.com/
*
* Copyright: © 2016 Kathy Darling
@helgatheviking
helgatheviking / sul-taxonomies.php
Last active July 9, 2016 01:51
Add user taxonomy/term arguments to Simple User Listing
<?php
/**
* Plugin Name: Simple User Listing Taxonomy Support
* Plugin URI: https://gist.github.com/helgatheviking/e032c4103b0d6caf997439f1df3bcdbe
* Description: add a taxonomy query to users
* Version: 1.0.0b
* Author: Kathy Darling
* Author URI: http://kathyisawesome.com/
*
* Copyright: © 2016 Kathy Darling
@helgatheviking
helgatheviking / functions.php
Created July 12, 2016 20:38
Add the product's short description to the Mix and Match table
add_action( 'woocommerce_mnm_row_item_description', 'mnm_add_short_description', 15 );
function mnm_add_short_description( $mnm_product ){
if ( ! $mnm_product->post->post_excerpt ) {
return;
}
?>
<div itemprop="description">
<?php echo apply_filters( 'woocommerce_short_description', $mnm_product->post->post_excerpt ) ?>
@helgatheviking
helgatheviking / wc-nyp-sold-individually.php
Last active July 28, 2016 21:32
Force NYP products to respect "sold individually" regardless of price
<?php
/**
* Plugin Name: WooCommerce Name Your Price Sold Individually
* Plugin URI: https://gist.github.com/helgatheviking/25e57fe033d719059dcf994ffe33d718
* Description: Double check enforcement of "Sold Individually" for NYP items
* Version: 1.0.0
* Author: Kathy Darling
* Author URI: http://kathyisawesome.com/
*
* Copyright: © 2016 Kathy Darling
@helgatheviking
helgatheviking / wc-nyp-sold-individually.php
Last active December 21, 2018 13:58
Force NYP products to respect "sold individually" regardless of price. Requires WC 2.6.3
<?php
/**
* Plugin Name: WooCommerce Name Your Price Sold Individually
* Plugin URI: https://gist.github.com/helgatheviking/a8802255167751a5dd746f83cdfc8716
* Description: Stricter enforcement of "Sold Individually" for NYP items
* Version: 1.2.0
* WC requires at least: 2.6.3
* Author: Kathy Darling
* Author URI: http://kathyisawesome.com/
*
@helgatheviking
helgatheviking / custom-modal-metabox.js
Last active May 21, 2024 10:43
Create a completely custom media frame (WIP)
/**
* @type {Object} JavaScript namespace for our application.
*/
var Custom_Modal = {};
(function($, Custom_Modal) {
var $ = jQuery;
_.extend( Custom_Modal, { view: {}, controller: {} } );
@helgatheviking
helgatheviking / woocommerce-shipping-contact.php
Last active June 7, 2023 11:34
Add a shipping email/phone field to checkout and notify of new orders
<?php
/*
Plugin Name: WooCommerce Shipping Contact
Plugin URI: https://github.com/helgatheviking/wc-shipping-contact
Description: Add a shipping email field to checkout and notify of new orders
Version: 1.1.0
Author: Kathy Darling
Author URI: http://kathyisawesome.com
Requires at least: 4.0
Tested up to: 4.8
@helgatheviking
helgatheviking / functions.php
Created October 7, 2016 00:21
Add short description after Mix and Match product title
/*
* Add product descriptions after product title
* fair warning: longer descriptions will be very cramped, this is just an example
* @param obj $mnm_product: the mix and matched product
* @param obk $product, the parent/container product
*/
function kia_add_descriptions_to_mnm( $mnm_product, $product ){
$short_description = $mnm_product->post->post_excerpt;
if ( ! $short_description ) {