Skip to content

Instantly share code, notes, and snippets.

View MattRyanCo's full-sized avatar

Matt Ryan MattRyanCo

View GitHub Profile
@MattRyanCo
MattRyanCo / code.js
Created March 14, 2015 22:03
First dynamic website eg with edity
function currentTime() {
var currentTime = new Date();
var rhours, hours = currentTime.getHours();
var minutes = currentTime.getMinutes();
if (minutes < 10) {
minutes = "0" + minutes;
}
if (hours > 12) {
rhours = hours - 12;
}

Date: [date]

Between us [company name] and you [customer name].

Summary:

In short; neither of us will share any confidential information about each-other, by any means, with anyone else.

What’s confidential information?

@MattRyanCo
MattRyanCo / 0_reuse_code.js
Last active August 29, 2015 14:18
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
@MattRyanCo
MattRyanCo / WooCommerce Add Insurance Fee
Last active October 5, 2016 14:38
Add variable USPS insurance fee to WooCommerce cart based on the value of the contents of the cart AND shipping with USPS
/**
* Add an insurance surcharge to your cart / checkout
* change the insurance amount based on value of cart
* Uses the WooCommerce fees API
*
*/
add_action( 'woocommerce_cart_calculate_fees','woocommerce_custom_surcharge' );
function woocommerce_custom_surcharge() {
global $woocommerce;
@MattRyanCo
MattRyanCo / style-placeholder.css
Created January 20, 2017 18:02
Gravity Forms placehold style changes for intensity
::-moz-placeholder {
color: #a5a6a4;
/*color: #20221d;*/
font-weight: 100;
opacity: 1;
@MattRyanCo
MattRyanCo / gist:961a7a2562cf270352f0f0476510d174
Created May 10, 2017 20:38
Customize Genesis Search Form
//* Customize search form input box text
//* Ref: https://my.studiopress.com/snippets/search-form/
add_filter( 'genesis_search_text', 'sp_search_text' );
function sp_search_text( $text ) {
// return esc_attr( 'Search my blog...' );
return esc_attr( 'Seach ' . get_bloginfo( $show, 'display' ));
get_permalink();
}
@MattRyanCo
MattRyanCo / gist:81dcf91231b4dd2c93c37a497492a2ef
Created May 11, 2017 00:05
Gravity Forms - Enable Field Label Visibility
add_filter( 'gform_enable_field_label_visibility_settings', '__return_true' );
@MattRyanCo
MattRyanCo / gist:14a6dbcbb3c5b28fa90df01243a0a494
Created May 11, 2017 01:58
remove plugin installed stylesheets in genesis
add_action( 'wp_enqueue_scripts', 'sk_disable_simple_social_icons_styles', 11 );
function sk_disable_simple_social_icons_styles() {
if ( class_exists( 'Simple_Social_Icons_Widget' ) ) {
/** Dequeue icon styles */
wp_dequeue_style( 'simple-social-icons-font');
}
// We will make use of widget_title filter to
//dynamically replace custom tags with html tags
add_filter( 'widget_title', 'accept_html_widget_title' );
function accept_html_widget_title( $mytitle ) {
// The sequence of String Replacement is important!!
$mytitle = str_replace( '[link', '<a', $mytitle );
$mytitle = str_replace( '[/link]', '</a>', $mytitle );
@MattRyanCo
MattRyanCo / gist:a52f865299d90147587c8c29e3fa0553
Created June 7, 2017 19:56
Tweak Gravity Forms website field validation to insert protocol if missing (assumes http) - gets around full validation error
// Tweak Gravity Forms website field validator to insert protocol if missing (assumes http)
// Ref: https://www.itsupportguides.com/knowledge-base/gravity-forms/gravity-forms-how-to-automatically-add-http-to-submitted-website-field-values-before-validation/
add_filter( 'gform_pre_render', 'itsg_check_website_field_value' );
add_filter( 'gform_pre_validation', 'itsg_check_website_field_value' );
function itsg_check_website_field_value( $form ) {
foreach ( $form['fields'] as &$field ) { // for all form fields
if ( 'website' == $field['type'] || ( isset( $field['inputType'] ) && 'website' == $field['inputType']) ) { // select the fields that are 'website' type
$value = RGFormsModel::get_field_value($field); // get the value of the field
if (! empty($value) ) { // if value not empty
$field_id = $field['id']; // get the field id