Skip to content

Instantly share code, notes, and snippets.

View hirejordansmith's full-sized avatar

Jordan Smith hirejordansmith

View GitHub Profile
<?php
// Remove gf_hidden and gf_invisible classes from all fields
add_filter( 'gform_pre_render', 'remove_display_hidden_classes' );
add_filter( 'gform_pre_validation', 'remove_display_hidden_classes' );
add_filter( 'gform_pre_submission_filter', 'remove_display_hidden_classes' );
add_filter( 'gform_admin_pre_render', 'remove_display_hidden_classes' );
function remove_display_hidden_classes( $form ) {
foreach ( $form['fields'] as &$field ) {
$classes = explode( ' ', $field->cssClass ); // 'class1 class2' : array( 'class1', 'class2' )
@hirejordansmith
hirejordansmith / functions.php
Created February 19, 2018 20:33
HJS // Force WordPress Images to link to Media File instead of Attachment Page Globally
<?php
add_shortcode( 'gallery', 'my_gallery_shortcode' );
function my_gallery_shortcode( $atts ) {
$atts['link'] = 'file';
return gallery_shortcode( $atts );
}
@hirejordansmith
hirejordansmith / functions.php
Created February 20, 2018 16:26
Add New Tab to the WooCommerce My Account Page
/**
* @snippet Add New Tab to WooCommerce My Account Page
* @author Hire Jordan Smith // https://hirejordansmith.com
*/
// Register new endpoint to use for My Account page
add_action( 'init', 'hjs_add_account_update_endpoint' );
function hjs_add_account_update_endpoint() {
add_rewrite_endpoint( 'account-update', EP_ROOT | EP_PAGES );
}
@hirejordansmith
hirejordansmith / modify-input-mask-placeholders-gravity-forms.php
Last active June 1, 2018 05:11
How to Modify Input Mask Placeholders for Gravity Forms
<?php
/*
Gravity Wiz // Gravity Forms // How to Modify Input Mask Placeholders for Gravity Forms
http://gravitywiz.com/how-to-modify-input-mask-placeholders-for-gravity-forms/
*/
<script type="text/javascript">
setTimeout( function() {
jQuery( '#input_FORMID_FIELDID' ).mask( 'MASK', { placeholder: '' } );
}, 500 );
@hirejordansmith
hirejordansmith / get-cart-contents-total-cost-woocommerce.php
Created September 15, 2016 18:07
How to Get Cart Contents and Total Cost with WooCommerce
<a class="cart-contents" href="<?php echo wc_get_cart_url(); ?>" title="<?php _e( 'View your shopping cart' ); ?>">
<?php echo sprintf ( _n( '%d item', '%d items', WC()->cart->get_cart_contents_count() ), WC()->cart->get_cart_contents_count() ); ?> - <?php echo WC()->cart->get_cart_total(); ?>
<i class="material-icons">shopping_cart</i>
</a>
@hirejordansmith
hirejordansmith / gf-2-3-database-updates.txt
Last active December 12, 2018 13:25
Gravity Forms 2.3 Database Updates
rg_lead_meta -> gf_entry_meta
rg_lead_detail -> gf_entry_meta
rg_lead -> gf_entry
All lead_id columns -> entry_id
rg_form_meta -> gf_form_meta
rg_form_view -> gf_form_view
rg_form -> gf_form
@hirejordansmith
hirejordansmith / app.js
Created November 22, 2016 10:45
Hash Tag Popup for WordPress
(function ($) {
"use strict";
/**
Creates an instance of Lightbox.
@constructor
@this {Lightbox}
@param {object} $container The container.
@param {object} opts Options.
@hirejordansmith
hirejordansmith / create-product-bundles-by-adding-coupons-to-cart-dynamically-based-on-products-in-the-cart.php
Last active March 7, 2019 09:00
Create Product Bundles by adding coupons to cart dynamically based on products in the cart - WooCommerce
<?php
/**
* Hire Jordan Smith // Create Product Bundles by adding coupons to cart dynamically based on products in the cart
*
* @version 1.0
* @author Jordan Smith <jordan@hirejordansmith.com>
* @license GPL-2.0+
* @link http://hirejordansmith.com/...
* @copyright 2016 - Hire Jordan Smith
@hirejordansmith
hirejordansmith / change-product-description-title-woocommerce.php
Created September 15, 2016 21:23
How to Change or Remove the Product Description Title in WooCommerce
<?php
// Change the Product Description Title
add_filter('woocommerce_product_description_heading', 'hjs_product_description_heading');
function hjs_product_description_heading() {
return __('NEW TITLE HERE', 'woocommerce');
}
// Remove the Product Description Title
add_filter('woocommerce_product_description_heading', 'hjs_product_description_heading');
@hirejordansmith
hirejordansmith / replace-ajax-spinner-with-custom-spinner.css
Created August 11, 2016 21:05
Replace AJAX Spinner with Custom Spinner
/*
hourglass.gif replaces the default AJAX spinner
http://loading.io/ <- Good place to find a new one
*/
body img.gform_ajax_spinner {
position: fixed !important;