Skip to content

Instantly share code, notes, and snippets.

View NiklasHogefjord's full-sized avatar

Niklas Högefjord NiklasHogefjord

View GitHub Profile
@NiklasHogefjord
NiklasHogefjord / gist:3043748
Created July 3, 2012 22:14
Swedish Greys filter multiple comments text
// Change the output of multiple comments text in Post header meta or Post footer meta
add_filter( 'ntp_multiple_comment_text', 'themename_multiple_comment_text' );
function themename_multiple_comment_text() {
return 'Comments: % Comments';
}
@NiklasHogefjord
NiklasHogefjord / gist:6104328
Created July 29, 2013 13:33
WooCommerce - Display cart total weight on the cart page
<?php
/**
* WooCommerce
* --------------
*
* Display cart total weight on the cart page
*
*/
add_action('woocommerce_cart_collaterals', 'myprefix_cart_extra_info');
@NiklasHogefjord
NiklasHogefjord / gist:6104436
Created July 29, 2013 13:52
WooCommerce - Remove related products from single product page
<?php
/**
* WooCommerce
* --------------------------
*
* Remove related products
*
* Clear the query arguments for related products so none show.
*
*/
@NiklasHogefjord
NiklasHogefjord / gist:6111426
Created July 30, 2013 09:05
WooCommerce - Hide all prices
<?php
/**
* WooCommerce
* --------------
*
* Hide all prices in your store.
*
* Can be useful when using WooCommerce as a quote tool.
*
*/
@NiklasHogefjord
NiklasHogefjord / gist:7566282
Created November 20, 2013 16:33
WooCommerce, Klarna payment gateway - Add input field for Billing Phone to Klarna (Invoice) Payment gateway Description area.
<?php
/**
* WooCommerce - Klarna
* --------------
*
* Add input field for Billing Phone to Klarna (Invoice) Payment gateway Description area.
*
* Can be useful if the regular WC checkout form is stripped down since Klarna require a Phone number.
*
*/
@NiklasHogefjord
NiklasHogefjord / gist:8175900
Created December 29, 2013 23:18
Swedish Greys - Set the logo area to be as wide as the entire header width
#site-title {
width: 900px;
}
#header-widget {
width: 0px;
}
@NiklasHogefjord
NiklasHogefjord / gist:fd76f7e2d4f2e6a21e8f
Created July 14, 2014 12:07
WooCommerce, DIBS Payment Gateway - Add the DIBS Transaction ID to order emails
/**
* Add the DIBS Transaction ID to order emails
**/
add_filter('woocommerce_email_order_meta_keys', 'dibs_woocommerce_email_order_meta_keys');
function dibs_woocommerce_email_order_meta_keys( $keys ) {
$keys['DIBS Transaction ID'] = 'dibs_transaction_no';
return $keys;
}
@NiklasHogefjord
NiklasHogefjord / woocommerce-dibs-paytypes
Created October 1, 2014 12:58
WooCommerce, DIBS Payment Gateway - Filter the paytype sent to DIBS
/**
* WooCommerce - DIBS payment gateway
* Filter the paytype sent to DIBS
*
**/
add_filter('woocommerce_dibs_paytypes', 'myprefix_dibs_paytypes');
function myprefix_dibs_paytypes( $paytypes ) {
// Multiple paytypes are added comma separated.
@NiklasHogefjord
NiklasHogefjord / WooCommerce - Double.net tracking code example
Last active August 31, 2015 09:54
WooCommerce - Double.net tracking code example
<?php
/**
* WooCommerce - Double.net Tracking code
*
**/
add_action( 'woocommerce_thankyou', 'my_custom_tracking' );
function my_custom_tracking( $order_id ) {
$order = new WC_Order( $order_id );
$reference = ltrim( $order->get_order_number(), '#');
@NiklasHogefjord
NiklasHogefjord / gist:3f4a8a12462252450149
Created February 17, 2015 13:58
WooCommerce, Payson Payment Gateway - Change the Payson Direct icon in checkout
<?php
/**
* WooCommerce - Payson payment gateway
* Change the Payson Direct icon in checkout
*
**/
function myprefix_change_payson_direct_icon($logourl) {
return get_stylesheet_directory_uri(). '/images/my-payson-icon.png';
}
add_filter('payson_direct_icon', 'myprefix_change_payson_direct_icon');