Skip to content

Instantly share code, notes, and snippets.

@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 / WooCommerce - Change Checkout Notes Label and Place Holder Text
Created April 29, 2015 14:48
WooCommerce - Change Checkout Notes Label and Place Holder Text
/*-----------------------------------------------------------------------------------*/
/* WooCommerce - Change Checkout Notes Label and Place Holder Text
/*-----------------------------------------------------------------------------------*/
// Hook in
add_filter( 'woocommerce_checkout_fields' , 'theme_override_checkout_notes_fields' );
// Our hooked in function - $fields is passed via the filter!
function theme_override_checkout_notes_fields( $fields ) {
$fields['order']['order_comments']['placeholder'] = 'Add some order notes or a gift message here.';
@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 / 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 / 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;
}
@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) }}

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 / Add Body Classes.php
Created September 27, 2016 02:12
Add CSS classes to the body tag depending on what page you are on.
//For this to work you need to change the body tag to look like this:
//<body <?php body_class() ?>>
function add_body_classes( $classes ) {
// Adds a class if post type is books
if ( is_singular('book') ) {
$classes[] = 'book-single';
}
// add class if not home page
if ( ! is_home() ) {
@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' ),