This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
add_filter( 'woocommerce_add_to_cart_validation', 'woocommerce_nyp_make_field_required', 10, 5 ); | |
function woocommerce_nyp_make_field_required( $passed, $product_id, $quantity, $variation_id = '', $variations= '' ) { | |
if( $variation_id ) | |
$product_id = $variation_id; | |
// skip if not a nyp product - send original status back | |
if ( ! WC_Name_Your_Price_Helpers::is_nyp( $product_id ) ){ | |
return $passed; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
* 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 | |
*/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
* 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 | |
*/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
* Submit form even if user is already subscribed to AWeber List | |
* | |
* @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 | |
*/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function remove_free_shipping_items( $packages ) { | |
foreach( $packages as $i => $package ){ | |
foreach ( $package['contents'] as $key => $item ) { | |
if ( $item['data']->get_shipping_class() == 'free' ) { | |
unset( $packages[$i]['contents'][$key] ); | |
add_filter( 'woocommerce_cart_needs_shipping', '__return_true' ); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/* | |
Plugin Name: Nav Menu Roles + Session Roles | |
Plugin URI: http://www.kathyisawesome.com/449/nav-menu-roles/ | |
Description: Hide custom menu items based on session variables | |
Version: 1.0.0 | |
Author: Kathy Darling | |
Author URI: http://www.kathyisawesome.com | |
License: GPL-3.0 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* Adds a box to the main column on the Post and Page edit screens. | |
*/ | |
function myplugin_add_meta_box() { | |
$screens = array( 'post', 'page' ); | |
foreach ( $screens as $screen ) { | |
add_meta_box( |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* Converts the WooCommerce country codes to 3-letter ISO codes | |
* https://en.wikipedia.org/wiki/ISO_3166-1_alpha-3 | |
* @param string WooCommerce's 2 letter country code | |
* @return string ISO 3-letter country code | |
*/ | |
function kia_convert_country_code( $country ) { | |
$countries = array( | |
'AF' => 'AFG', //Afghanistan |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* 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 ); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
* 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 |