Skip to content

Instantly share code, notes, and snippets.

@JeffAspen
JeffAspen / gist:dc8c2c0e87b9eed08857
Last active August 25, 2015 20:16 — forked from thegdshop/gist:3171026
WooCommerce - Add checkbox field to the checkout
<?php
/**
* Add checkbox field to the checkout
**/
add_action('woocommerce_after_order_notes', 'my_custom_checkout_field');
function my_custom_checkout_field( $checkout ) {
echo '<div id="my-new-field"><h3>'.__('My Checkbox: ').'</h3>';
@JeffAspen
JeffAspen / gist:f52d7cde646aa2f211b5
Created April 29, 2015 14:41
WooCommerce Checkout Order Notes Placeholder
/*-----------------------------------------------------------------------------------*/
/* WooCommerce - Change Order Notes Placeholder Text
/*-----------------------------------------------------------------------------------*/
add_filter( 'woocommerce_checkout_fields', 'theme_woocommerce_checkout_fields' );
function theme_woocommerce_checkout_fields( $fields ) {
$fields['order']['order_comments']['placeholder'] = 'Add your custom message here';
return $fields;
@JeffAspen
JeffAspen / 0_reuse_code.js
Last active August 29, 2015 14:22
Here are some things you can do with Gists in GistBox.
// Use Gists to store code you would like to remember later on
console.log(window); // log the "window" object to the console
//the next few lines strip "or Create an Account" from the log-in menu option
//I usually set the overall navigation to display:none; in my CSS if I know js is enabled
//I use Modernizr and check for the js class on the <html> tag with the style selector for my menu
//like: .js #navigation { display: none; }
//You'll want to add a class or ID to the <div> containing the log-in/log-out link
//usual output (with added ID):
//<li>
// <div id="log_in_options">
// <a onclick="" href="[url]">Sign in</a> or <a onclick="" href="[url]">Create an account</a>
@JeffAspen
JeffAspen / Image Swap
Created November 16, 2015 18:22
CSS Image Swap
<div class="hover_effect">
<img src="PATH-TO-FIRST-IMAGE" class="first">
<img src="PATH-TO-SECOND-IMAGE" class="second>
</div>
<style type="text/css" media="screen">
.hover_effect .second {
display: none;
}

Blog Layouts

Two column blog card style layouts with hover effects. Card layout has an option with and without icons.

A Pen by Jeff Aspen on CodePen.

License.

@JeffAspen
JeffAspen / WP Testimonial CPT
Created October 27, 2016 14:15
WP Testimonial CPT
// Register Custom Post Type
function cmms_testimonial_post_type() {
$labels = array(
'name' => _x( 'Testimonials', 'Post Type General Name', 'cmms' ),
'singular_name' => _x( 'Testimonial', 'Post Type Singular Name', 'cmms' ),
'menu_name' => __( 'Testimonials', 'cmms' ),
'name_admin_bar' => __( 'Testimonial', 'cmms' ),
'archives' => __( 'Item Archives', 'cmms' ),
'parent_item_colon' => __( 'Parent Item:', 'cmms' ),
@JeffAspen
JeffAspen / Hubspot - Blog Excerpt Length
Created January 29, 2016 17:49
Hubspot - Blog Excerpt Length
//Change HubSpot Blog Excerpt Length WITHOUT using the "more tag" feature.
{{ content.post_list_content|safe|truncatehtml(300, '...' , false) }}
@JeffAspen
JeffAspen / gist:b9a3f16d263ee1a0ac8c8860a8b5a528
Created October 8, 2017 03:37
Prevent WordPress plugins from requesting updates
/*
* https://ben.lobaugh.net/blog/202432/prevent-wordpress-plugins-from-requesting-updates
* Be sure to change [plugin_folder]/[plugin_file].php to the plugin you want to prevent updating.
*/
add_filter( 'site_transient_update_plugins', array( 'no_updates_for_you' ) );
function no_updates_for_you( $value ) {
/**
* Spacer
*
* @since 1.3.0
* Use the shortcode: [spacer class="css-class-name" height="30px"]
* Note: Since the space size uses an inline style your css class may have to use an !important
*/
function cmms_spacer_shortcode( $atts ) {
// Attributes