Skip to content

Instantly share code, notes, and snippets.


Keybase proof

I hereby claim:

  • I am chriscree on github.
  • I am chriscree ( on keybase.
  • I have a public key ASBg0gh-qMpcMeIa5fx4dKQpWtD3xKxp2deSgg_J3Qe4qwo

To claim this, I am signing this object:

ChrisCree / functions.php
Created Apr 26, 2016
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…
View functions.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' ) ) {
ChrisCree / genesis_accessible_styles.css
Created Apr 22, 2016
Genesis accessibility CSS for quick reference along with PHP code to add theme support for HTML5 markup, mobile viewport, and accessibility features in child themes.
View genesis_accessible_styles.css
/********** Screen Reader Text starts about line 482 ************/
th {
font-weight: 400;
/* ## Screen Reader Text
--------------------------------------------- */
ChrisCree / Usage.txt
Created Oct 21, 2015
Genesis 2.2+ custom archive page template for customizing sitemap output. Copy the page_archive.php file, edit it as desired per the Usage.txt instructions below, and FTP it up to your Genesis child theme directory. Then create a page using the Archive page template to display your results.
View Usage.txt
The functions can be modified as needed using parameters from the WordPress Codex.
For example, to exclude specific pages line 30 above would be changed to this instead:
$sitemap .= sprintf( '<ul>%s</ul>', wp_list_pages( 'title_li=&echo=0&exclude=174,180' ) );
Where 174 & 180 are the page ID's of the pages to be omitted.
Here are the respective Codex pages for each function to find what parameters can be used:
ChrisCree / search_posts_only.php
Last active Sep 30, 2015
How to only return blog posts for the default WordPress search function.
View search_posts_only.php
// Don't copy opening PHP tag above
// Add below code to your theme's functions.php file.
// Only show blog posts in search results
add_filter( 'pre_get_posts','wsm_post_only_search_filter' );
function wsm_post_only_search_filter( $query ) {
if ( $query->is_search ) {
$query->set( 'post_type', 'post' );
ChrisCree / functions.php
Last active Sep 13, 2015
Change out logo images in the Genesis theme framework depending on which language is selected via WPML.
View functions.php
// Don't copy above opening PHP tag
// Display Custom logo based on WPML language displayed
function wsm_lang_logo_image_logic() {
if ( !defined( 'ICL_LANGUAGE_CODE' ) ) {
ChrisCree / functions.php
Created Mar 10, 2015
Change WooCommerce $0 zero price output from Free! to something else.
View functions.php
// Do not copy the opening <?php tag above
// Customize the Free! price output
add_filter( 'woocommerce_variable_free_price_html','wsm_custom_free_price' );
add_filter( 'woocommerce_free_price_html', 'wsm_custom_free_price' );
add_filter( 'woocommerce_variation_free_price_html', 'wsm_custom_free_price' );
function wsm_custom_free_price( $price ) {
// Edit content between single quotes below to desired output
return 'Prepaid Inventory';
ChrisCree / gf-setngs_functions.php
Created Mar 4, 2015
Filter to enable the setting in Gravity Forms where users can hide the field labels. This is useful in conjunction with the new Gravity Forms placeholder functionality as of version 1.9+
View gf-setngs_functions.php
// DO not copy opening PHP tag above
// Enable Gravity Forms setting to hide form labels
add_filter( 'gform_enable_field_label_visibility_settings', '__return_true' );
ChrisCree / functions.php
Created Dec 5, 2014
Function for customizing the Genesis post info function based on date post was published. For example the below function shows different post info for posts more than 6 months old. Adjust as required.
View functions.php
// Don't copy opening PHP tag above
// Customize the post info function by date
add_filter( 'genesis_post_info', 'wsm_post_info_filter' );
function wsm_post_info_filter( $post_info ) {
$post_date = the_date( 'Y-m-d','','', false );
$date_limit = date( "Y-m-d", mktime(0,0,0,date("m")-6, date("d"), date("Y")) );
ChrisCree / androidmenu-functions.php
Last active Dec 14, 2015
Fix for Android devices, Genesis themes and dropdown menus.
View androidmenu-functions.php
// Do not copy opening PHP tag above
// Fix for Android devices not showing drop down menus when top level menu item clicked
add_filter( 'genesis_superfish_enabled', '__return_true' );
add_action( 'wp_enqueue_scripts', 'wsm_android_hover_fix' );
function wsm_android_hover_fix() {
wp_enqueue_script( 'hoverIntent' );