Skip to content

Instantly share code, notes, and snippets.

View devinsays's full-sized avatar

Devin Price devinsays

View GitHub Profile
/**
* Upsell notice for theme
*/
( function( $ ) {
// Add Upgrade Message
if ('undefined' !== typeof prefixL10n) {
upsell = $('<a class="prefix-upsell-link"></a>')
.attr('href', prefixL10n.prefixURL)
@devinsays
devinsays / friendbuy_conversion_tracker
Created May 15, 2015 22:55
FriendBuy Conversion Tracker
<?php
/**
* Friendbuy conversion tracker
*
*/
function friendbuy_conversion_tracker( $order_id ) {
// Lets grab the order
$order = new WC_Order( $order_id );
?>
<script>
/**
* Load alternate page on front page
*/
function prefix_query_change( $query ) {
// Only filter the main query on the front-end
if ( is_admin() || ! $query->is_main_query() ) {
return;
}
@devinsays
devinsays / tagline-color-option.php
Last active August 29, 2015 14:22
Tagline Color Option
<?php
/**
* Additional theme customizer options
*
* @param WP_Customize_Manager $wp_customize Theme Customizer object.
*/
function prefix_customize_register( $wp_customize ) {
$wp_customize->add_setting( 'prefix[header_taglinecolor]', array(
'default' => '#222222',
@devinsays
devinsays / tagline-color-styles.php
Last active August 29, 2015 14:22
Tagline Color Style Output
/**
* Output styles in the header
*/
function prefix_inline_styles() {
$options = get_option( 'prefix', false );
if ( ! $options ) {
return;
}
@devinsays
devinsays / sanitize_hex_color.php
Last active September 10, 2015 18:14
sanitize_hex_color
/**
* Duplicate the sanitize_hex_color function, which is generally
* only available to the theme customizer.
*/
if ( !function_exists( 'sanitize_hex_color' ) ) {
function sanitize_hex_color( $color ) {
if ( '' === $color )
return '';
// 3 or 6 hex digits, or the empty string.
@devinsays
devinsays / efficient-fitvids.php
Created June 15, 2015 22:49
Efficient Script Loading for oEmbeds
/**
* Enqueue theme scripts
*/
function prefix_scripts() {
// FitVids Script conditionally enqueued from inc/extras.php
wp_register_script(
'prefix-fitvids',
get_template_directory_uri() . '/js/jquery.fitvids.min.js',
array( 'jquery' ),
@devinsays
devinsays / wc-tracking-example.php
Created June 29, 2015 17:42
Example of WooCommerce Conversion Tracking
function prefix_service_conversion_tracking( $order_id ) {
// Lets grab the order
$order = new WC_Order( $order_id );
// Order ID
$order_id = $order->get_order_number();
// Order total
$order_total = $order->get_total();
@devinsays
devinsays / wc-tracking-products-example.php
Created June 29, 2015 17:49
Example of WooCommerce Conversion Tracking for Products
function prefix_service_conversion_tracking( $order_id ) {
// Lets grab the order
$order = new WC_Order( $order_id );
// Products
$products = $order->get_items();
?>
<script>
@devinsays
devinsays / wc-footer-conversion-tracking-example.php
Last active July 18, 2023 14:27
Example of WooCommerce Conversion Tracking in wp_footer