Skip to content

Instantly share code, notes, and snippets.

View stevenhoney's full-sized avatar

Steve stevenhoney

  • New Zealand
  • 02:48 (UTC +12:00)
View GitHub Profile
add_filter('woocommerce_get_price','change_price', 10, 2);
add_filter('woocommerce_get_regular_price','change_price', 10, 2);
add_filter('woocommerce_get_sale_price','change_price', 10, 2);
function change_price( $price, $product_id ){
$front_prijs = get_field( 'front_prijs', $product_id );
$tekst_na_prijs = get_field( 'tekst_na_prijs', $product_id );
<?php
query_posts( array( 'post_type' => 'peeps', 'paged' => $paged ) );
?>
<?php
$divider = 4;
$i = 1;
?>
<!-- open starting div before loop -->
<?php if (have_posts()) : ?>
<div class="row leaders">
<?php
add_filter( 'woocommerce_email_headers', 'sh_add_bcc_order_email', 10, 3);
function sh_add_bcc_order_email( $headers, $email_id, $order ) {
// list of possible values for $email_id can be found here http://www.mootpoint.org/blog/customising-woocommerce-notification-emails-hooks-filters/
if ($email_id == 'customer_completed_order') {
$bcc_email = "[email protected]"; // change to the required email address here
$headers .= 'BCC: ' . $bcc_email . "\r\n";
}
return $headers;
<?php
/**
* Modified from https://www.skyverge.com/blog/add-woocommerce-email-recipients-conditionally/
*
* Add another email recipient for admin New Order emails if a product from a specific category or with a specific tag is ordered
*
* @param string $recipient a comma-separated string of email recipients (will turn into an array after this filter!)
* @param \WC_Order $order the order object for which the email is sent
* @return string $recipient the updated list of email recipients
*/
@stevenhoney
stevenhoney / limit_users_single_email_domain.php
Last active May 26, 2016 14:25
Only allow users with an email address at a specific domain to register
function allow_single_email_domain( $user_login, $user_email, $errors ) {
if ( strpos( $user_email, '@youralloweddomain.com' ) != -1 ) {
return;
} else {
$errors->add( 'bad_email_domain', '<strong>ERROR</strong>: This email domain is not allowed.' );
}
}
add_action( 'register_post', 'allow_single_email_domain', 10, 3 );
@stevenhoney
stevenhoney / filter_ninja_forms_forms_display_datepicker_args_not_working.php
Created April 11, 2016 13:05
Issue passing dates to datepicker in Ninja Forms
//Customise Datepicker on contact forms
function nf_datepicker_modify_script( $args ){
//for a list of arguments which can be used here, see the options here http://api.jqueryui.com/datepicker/
$args['dateFormat'] = 'mm/dd/yy';
$args['minDate'] = '06/15/15';
$args['minDate'] = '10/15/15';
return $args;
}
add_filter( 'ninja_forms_forms_display_datepicker_args', 'nf_datepicker_modify_script' );
@stevenhoney
stevenhoney / wc-remove-product-description-tab.php
Created October 23, 2015 12:17
Remove the product description tab in WooCommerce
<?php
/**
* Plugin Name: WooCommerce Remove Description Tab
* Plugin URI: https://wordpress.org/support/topic/how-to-keep-additional-info-but-remove-description
* Description: **Remove the product description tab.
* Version: 1.0
* Author: SteveHoneyNZ
* Tested up to: 4.3
*/
@stevenhoney
stevenhoney / shipment-tracking.php
Created October 4, 2014 11:21
Adding NZ Options to WooCommerce Shipment Tracking Plug In
//Added at Line 107
'New Zealand' => array(
'Courier Post'
=> 'http://trackandtrace.courierpost.co.nz/Search/%1$s',
'NZ Post'
=> 'http://www.nzpost.co.nz/tools/tracking?trackid=%1$s',
'Fastways'
=> 'http://www.fastway.co.nz/courier-services/track-your-parcel?l=%1$s',
'PBT Couriers'
@stevenhoney
stevenhoney / bxslider-picturefill-snippet
Created August 9, 2014 12:52
WP theme/plug in snippet - post_gallery filter replaces wp gallery with bxslider working with elf02 WP Responsive Images
<?php
// standard wp post_gallery filter set up
add_filter('post_gallery', 'bxslider_picturefill_gallery', 10, 2);
function bxslider_picturefill_gallery($output, $attr) {
global $post;
if (isset($attr['orderby'])) {