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 / 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 / theme-js-example.js
Created July 3, 2015 22:08
Example theme js that inits masonry
/*!
* Script for initializing globally-used functions and libs.
*
* @since 1.0.0
*/
(function($) {
var gather = {
// Cache selectors
@devinsays
devinsays / custom-content-example.php
Last active August 29, 2015 14:26
Customize control to output arbitrary content or HTML.
$wp_customize->add_setting( 'example-control', array() );
$wp_customize->add_control( new Prefix_Custom_Content( $wp_customize, 'example-control', array(
'section' => 'title_tagline',
'priority' => 20,
'label' => __( 'Example Control', 'govpress' ),
'content' => __( 'Content to output. Use <a href="#">HTML</a> if you like.', 'textdomain' ) . '</p>',
'description' => __( 'Optional: Example Description.', 'textdomain' ),
) ) );
@devinsays
devinsays / remove-jetpack-share.php
Created August 2, 2015 21:54
Example of how to remove the JetPack share buttons so that you can output them in a different part of the template.
/**
* Removes automatic display of JetPack share buttons
*/
function branch_remove_jetpack_share() {
remove_filter( 'the_content', 'sharing_display', 19 );
remove_filter( 'the_excerpt', 'sharing_display', 19 );
if ( class_exists( 'Jetpack_Likes' ) ) {
remove_filter( 'the_content', array( Jetpack_Likes::init(), 'post_likes' ), 30, 1 );
}
}
@devinsays
devinsays / authenticate-by-email.php
Created August 30, 2015 23:03
Allow login by e-mail address
<?php
/**
* Allows customer to log in using e-mail address
*
* @param string username
*/
function prefix_authenticate_by_email( &$username ) {
error_log( $username );