Skip to content

Instantly share code, notes, and snippets.

View tradesouthwest's full-sized avatar
Working remotely

Larry tradesouthwest

Working remotely
View GitHub Profile
$(document).ready(function(){
var maxField = 10; //Input fields increment limitation
var addButton = $('.add_button'); //Add button selector
var wrapper = $('.field_wrapper'); //Input field wrapper
var fieldHTML = '<div><input type="text" name="field_name[]" value=""/><a href="javascript:void(0);" class="remove_button"><img src="remove-icon.png"/></a></div>'; //New input field html
var x = 1; //Initial field counter is 1
//Once add button is clicked
$(addButton).click(function(){
@tradesouthwest
tradesouthwest / dot-htacess
Created July 11, 2019 21:57
htaccess compression best settings
# BEGIN WordPress
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
</IfModule>
@tradesouthwest
tradesouthwest / wp-plugin-enqueue-dequeue.php
Last active July 2, 2020 23:24
Remove styles via wp_enqueue and wp_dequeue. Bonus at bottom of file to select children of parent category
<?php
/** PB-1
* Remove woo specific styles that are added by this plugin if option checked
* Then re-enqueue when option is not isset (default)
*/
add_action( 'wp_enqueue_scripts', 'unitizr_products_enqueue_woospecific' );
function unitizr_products_enqueue_woospecific()
{
<?php
/**
* Parse HTML for 'checkbox' field
* @input type checkbox
*/
function unitizr_removestyles_field_cb($args)
{
$checked = '';
$options = get_option($args['option_name']);
$value = ( !isset( $options[$args['name']] ) )
<?php
/**
* Prevent direct access to the file.
* @subpackage vendors_tmplt/inc/vendors-tmplt-archive-content
* @since 1.0
*/
if ( ! defined( 'ABSPATH' ) ) {
exit;
}
@tradesouthwest
tradesouthwest / generate-formatted-url-link.php
Last active October 30, 2019 17:46
Generate a formatted url link from form fields. For WordPress as a shortcode
@tradesouthwest
tradesouthwest / gforms-field-validation-date.php
Created November 16, 2019 19:14
Gravity Forms date field validation filters by cutoff date.
<?php // Gravity Forms date field validation
add_filter( 'gform_field_validation_2_10', 'shopguide_gform_validation_2_10', 10, 4 );
function shopguide_gform_validation_2_10( $result, $value, $form, $field )
{
$valid = false;
$day_select = date( 'D', $value );
$date_selected = strtotime( $value );
$now = strtotime( 'now' );
$wed_next = strtotime( 'next Wednesday' );
$this_fri = strtotime( 'next Friday');
<?php
/**
* OnePress Child Theme Functions
* And basic parent/child enqueues
*
*/
/**
* Enqueue child theme style
*/
add_action( 'wp_enqueue_scripts', 'onepress_child_enqueue_styles', 15 );
<?php
/**
* The header for child-them custom full width page template
*
* This is the template that displays all of the <head> section and everything up until <div id="content">
*
* @link https://developer.wordpress.org/themes/basics/template-files/#template-partials
*
* @package Blossom_Spa
* ********************************************