Skip to content

Instantly share code, notes, and snippets.

@jamiemitchell
jamiemitchell / remove-genesis-cpt-archive-content.php
Created November 16, 2018 06:34 — forked from renventura/remove-genesis-cpt-archive-content.php
Remove content excerpt from custom post type archive in Genesis
<?php //* Mind this opening php tag
/**
* EngageWP.com
* Remove content excerpt from custom post type archive in Genesis
*/
//* Grab the content for each custom post type
add_action( 'genesis_before_loop', 'rv_cpt_excerpts' );
function rv_cpt_excerpts() {
@jamiemitchell
jamiemitchell / functions.php
Created November 16, 2018 04:06 — forked from mikejolley/functions.php
WooCommerce - Hide shipping rates when free shipping is available.
<?php
/**
* Hide shipping rates when free shipping is available.
* Updated to support WooCommerce 2.6 Shipping Zones.
*
* @param array $rates Array of rates found for the package.
* @return array
*/
function my_hide_shipping_when_free_is_available( $rates ) {
$free = array();
@jamiemitchell
jamiemitchell / gist:5e782aa2fa1ff7ca87e3893907fedf06
Created November 15, 2018 00:31 — forked from craigcooperxyz/gist:f7cf758dc395252b9356
Remove cross-sells from cart in WooCommerce
<?php
/*
* Remove Cross-Sells from the shopping cart page
*
* Copy and paste this code into functions.php to
* remove cross-sells from the cart in WooCommerce.
*
* You may need to remove the opening <?php tag
* before you add it to your functions file.
/* Woocommerce Styles */
/*
A couple things to note...
1. This code was written very specifically for my base child theme so it might not work out of the box with every theme.
I have it here mostly to share with anyone who might be looking to do the same thing I was.
2. I generally add my WooCommerce CSS overrides to a custom-woo.css file then use wp_enqueue_style() to call it
so that it enqueues after the default WooCommerce Stylesheets
@jamiemitchell
jamiemitchell / functions.php
Created November 4, 2018 07:47 — forked from ChrisCree/functions.php
Add the Shop page breadcrumb to single products and archives for WooCommerce pages with the Genesis framework. Code below can be added to your child theme's functions.php file. Then go to Genesis --> Theme Settings and ensure the Breadcrumbs settings for Posts and Archives is enabled. PLEASE NOTE: This code assumes the Genesis Connect for WooCom…
<?php
// Do not copy opening PHP tag above
// Add the Shop page to Genesis breadcrumbs in WooCommerce
// NOTE: Assumes Genesis Connect for WooCommerce plugin is active
add_filter( 'genesis_archive_crumb', 'wsm_prepend_shop_link', 11, 2 );
add_filter( 'genesis_single_crumb', 'wsm_prepend_shop_link', 11, 2 );
function wsm_prepend_shop_link( $crumb, $args ) {
if ( is_singular( 'product' ) || is_tax( 'product_cat' ) || is_tax( 'product_tag' ) ) {
@jamiemitchell
jamiemitchell / gravatar-avatar-outside-loop.php
Created September 29, 2018 06:03 — forked from carasmo/gravatar-avatar-outside-loop.php
Get Gravatar / Avatar Outside of loop WordPress.
<?php
//* Do not copy above. Add the hook where it's going. Change the function name to reflect your situation.
add_action( 'your_hook', 'themeprefix_author_gravatar_outside_loop_single_post' );
//* Author Gravatar/Avatar outside of Loop on Single posts
function themeprefix_author_gravatar_outside_loop_single_post() {
@jamiemitchell
jamiemitchell / archive-testimonials.php
Created August 19, 2018 01:49 — forked from cdils/archive-testimonials.php
Testimonial Archive Template
<?php
/**
* Template Name: Testimonial Archives
* Description: Used as a page template to show page contents, followed by a loop through a CPT archive
*/
remove_action ('genesis_loop', 'genesis_do_loop'); // Remove the standard loop
add_action( 'genesis_loop', 'custom_do_grid_loop' ); // Add custom loop
@jamiemitchell
jamiemitchell / acf-js.js
Created August 10, 2018 02:16 — forked from neilgee/acf-js.js
ACF Google Map - Get Directions Link
(function($) {
/*
* new_map
*
* This function will render a Google Map onto the selected jQuery element
*
* @type function
* @date 8/11/2013
* @since 4.3.0
<?php
/**
* Theme Setup
* @since 1.0.0
*
* This setup function attaches all of the site-wide functions
* to the correct hooks and filters. All the functions themselves
* are defined below this setup function.
*
@jamiemitchell
jamiemitchell / functions.php
Created July 4, 2018 08:41 — forked from srikat/functions.php
How to use Customizer API to add settings for Header background color and background image in Genesis. https://sridharkatakam.com/how-to-use-customizer-api-to-add-settings-for-header-background-color-and-background-image-in-genesis/
/**
* HEX Color sanitization callback.
*
* - Sanitization: hex_color
* - Control: text, WP_Customize_Color_Control
*
* Note: sanitize_hex_color_no_hash() can also be used here, depending on whether
* or not the hash prefix should be stored/retrieved with the hex color value.
*
* @see sanitize_hex_color() https://developer.wordpress.org/reference/functions/sanitize_hex_color/