Skip to content

Instantly share code, notes, and snippets.

View tankbar's full-sized avatar

Tankbar tankbar

View GitHub Profile
@tankbar
tankbar / grd_functions.php
Created January 24, 2017 07:56 — forked from gregrickaby/grd_functions.php
A "must use" plugin to help save theme-agnostic functions
<?php
/**
* Must-Use Functions
*
* A class filled with functions that will never go away upon theme deactivation.
*
* @package WordPress
* @subpackage GRD
*/
class GRD_Functions {
/**
* Be sure to include library scripts in this order. Can be placed either
* in the header or footer.
*/
<script src="//cdnjs.cloudflare.com/ajax/libs/jquery/2.1.0/jquery.min.js"></script>
<script src="//cdnjs.cloudflare.com/ajax/libs/jquery-infinitescroll/2.0b2.120519/jquery.infinitescroll.min.js"></script>
<script src="//cdnjs.cloudflare.com/ajax/libs/masonry/3.1.2/masonry.pkgd.js"></script>
<script src="//cdnjs.cloudflare.com/ajax/libs/jquery.imagesloaded/3.0.4/jquery.imagesloaded.min.js"></script>
@tankbar
tankbar / functions.php
Created January 24, 2017 07:54 — forked from gregrickaby/functions.php
Customize the excerpt length, strip tags, append, and change the "Read More" text
<?php
// DO NOT INCLUDE OPENING PHP TAG
/**
* Customize the excerpt length and strip tags
*/
function custom_excerpt ( $text ) {
global $post;
@tankbar
tankbar / remove-emoji-support.php
Created January 24, 2017 07:52 — forked from gregrickaby/remove-emoji-support.php
Remove WordPress Emoji Support
<?php
//* Do NOT include the opening php tag shown above. Copy the code shown below into functions.php
/**
* Remove emoji support.
*/
function grd_remove_emoji() {
remove_action( 'wp_head', 'print_emoji_detection_script', 7 );
remove_action( 'admin_print_scripts', 'print_emoji_detection_script' );
remove_action( 'admin_print_styles', 'print_emoji_styles' );
@tankbar
tankbar / functions.php
Created January 24, 2017 07:51 — forked from gregrickaby/functions.php
Filter a custom post type after it's been registered
<?php
/**
* Filter the Products CPT to register more options.
*
* @param $args array The original CPT args.
* @param $post_type string The CPT slug.
*
* @return array
*/
@tankbar
tankbar / functions.php
Created January 2, 2017 09:48
WordPress body class browser and OS detection
/**
* Browser and OS detection
* @link http://www.wpbeginner.com/wp-themes/how-to-add-user-browser-and-os-classes-in-wordpress-body-class/
*/
function dxms_browser_os_body_class( $classes ) {
global $is_lynx, $is_gecko, $is_IE, $is_opera, $is_NS4, $is_safari, $is_chrome, $is_iphone;
if( $is_lynx ) $classes[] = 'lynx';
elseif( $is_gecko ) $classes[] = 'gecko';
@tankbar
tankbar / _box-shadow.scss
Last active December 13, 2016 07:22
A nice shadow transition for boxes/blocks in a grid
//Use <div class="box box-shadow"> for a nice hover effect.
//@requires our _media-queries.scss
//Available classes <div class="box box-rounded box-border box-rounded box-shadow">
.box {
background-color: #fff;
overflow: hidden;
&.box-no-padding {
padding: 0;
@tankbar
tankbar / wc-tracking-criteo-thank-you-page
Last active July 4, 2017 11:25
Criteo tracking on Thank you page
<?php
// Criteo Thank you page - Sales Confirmation page
add_action( 'woocommerce_thankyou', 'criteo_tracking_cart', 80 );
function criteo_tracking_cart( $order_id ) {
$order = new WC_Order( $order_id );
$order_nr = $order->get_order_number();
$order_email = get_user_meta( $order->user_id, 'billing_email', true );
$source_address = $order_email;
$processed_address = strtolower($source_address); //convert address to lower case
@tankbar
tankbar / wc-tracking-adtraction-thank-you-page
Last active February 20, 2024 15:31
Adtraction affiliate tracking on Thank you page
<?php
// Adtraction conversion tracking implementation
add_action( 'woocommerce_thankyou', 'adtraction_tracking', 60 );
function adtraction_tracking( $order_id ) {
$order = new WC_Order( $order_id );
$order_nr = $order->get_order_number();
$order_total_shipping = $order->get_total_shipping();
$order_total_ex_vat = $order->get_total() - $order->get_total_tax();
$order_total = $order_total_ex_vat - $order_total_shipping;
$order_email = get_user_meta( $order->user_id, 'billing_email', true );
@tankbar
tankbar / _gravity-forms.scss
Created October 12, 2016 13:25
Styling classes for Gravity Forms
/*-------------------------------------------------------------------------*/
/* Gravity Forms
/*-------------------------------------------------------------------------*/
.gform_wrapper {
input[type=text],
input[type=url],
input[type=email],
input[type=tel],
input[type=number],