Skip to content

Instantly share code, notes, and snippets.

@helgatheviking
helgatheviking / nf-aweber-custom-error-messages.php
Last active December 24, 2015 18:40
Ninja Forms AWeber: Custom error messages
/*
* Custom AWeber Error Messages
*
* @param $msg - current message from Ninja Forms for AWeber
* @param $error_code - null, placeholder for when AWeber gets error codes
* @param $error_message - original message from AWeber
* @param $subscriber - array of info about the subscriber submitted via form
* -- nb the form's ID can be found in $subscriber['form_id']
* @param $list_id the list ID
*/

Fluid Grid Using Text-align: Justify

A new technique for responsive grids I've been working on which uses inline-block and text-align: justify.

Take a look at this article for an explanation of the fundamentals of the technique:

http://www.barrelny.com/blog/text-align-justify-and-rwd/

Essentially, margins are calculated by the browser and never specified in the CSS. This saves a lot of tedious work! Also by not having to use floats, clearfixes, or nth-child, we avoid many common problems associated with more traditional methods.

@helgatheviking
helgatheviking / ninja-forms-suppress-all-errors.php
Last active March 4, 2016 16:36
Ninja Forms AWeber Suppress all errors: Ninja Forms AWeber 1.3.1 is required for this to work
/*
* Suppress ALL AWeber errors and submit form
*/
add_filter( 'ninja_forms_aweber_show_errors', '__return_false' );
/*
* Suppress ALL AWeber errors on form id=5 and submit form
*
* @param $msg - current message from Ninja Forms for AWeber
@helgatheviking
helgatheviking / list-hooks.php
Created February 16, 2016 15:49
Advanced debugging of all functions attached to a specific filter
/**
* Even fancier debug info
* @props @Danijel http://stackoverflow.com/a/26680808/383847
* @since 1.7.7
*/
function list_hooks( $hook = '' ) {
global $wp_filter;
$hooks = isset( $wp_filter[$hook] ) ? $wp_filter[$hook] : array();
$hooks = call_user_func_array( 'array_merge', $hooks );
@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 / ninja-forms-aweber-suppress-specific-error.php
Last active September 10, 2016 23:59
Ninja Forms AWeber Suppress certain errors
/*
* Submit form even if user is already subscribed to AWeber List
*
* @param $msg - current message from Ninja Forms for AWeber
* @param $error_message - original message from AWeber
* @param $error_code - null, placeholder for when AWeber gets error codes
* @param $subscriber - array of info about the subscriber submitted via form
* -- nb the form's ID can be found in $subscriber['form_id']
* @param $list_id the list ID
*/
@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 ) {
@helgatheviking
helgatheviking / ninja-forms-suppress-all-errors-plugin.php
Last active December 19, 2016 05:08
Ignores all AWeber errors and submits form. Requires Ninja Forms AWeber 1.3.1+. No longer required when using Ninja Forms THREE
<?php
/**
* Plugin Name: Suppress all Ninja Forms AWeber errors
* Plugin URI: https://gist.github.com/helgatheviking/2347fd5dffe56b38bd71f269fa40da02
* Description: Ignores all AWeber errors and submits form. Requires Ninja Forms AWeber 1.3.1+. No longer required when using Ninja Forms THREE.
* Version: 1.0.0
* Author: helgatheviking
* Author URI: https://kathyisawesome.com
* Requires at least: 4.6
* Tested up to: 4.7