Skip to content

Instantly share code, notes, and snippets.

View multiplehats's full-sized avatar
🎯
Focusing

Chris Jayden multiplehats

🎯
Focusing
View GitHub Profile
@vctrtvfrrr
vctrtvfrrr / spacing.sass
Last active March 12, 2019 14:49
Sass spacing helper
$sizeUnit: rem
$marginKey: "m"
$paddingKey: "p"
$separator: "-"
$sizes: ("none", 0), ("auto", auto), ("xxs", 0.125), ("xs", 0.25), ("sm", 0.5), ("md", 1), ("lg", 2), ("xl", 4), ("xxl", 8)
$positions: ("t", "top"), ("r", "right"), ("b", "bottom"), ("l", "left")
@function sizeValue($key, $value)
@return if($key == "none" or $key == "auto", $value, $value + $sizeUnit)
@celsowhite
celsowhite / wp-clean-admin.php
Created August 2, 2017 14:37
Functions to clean admin dashboard menu and welcome screen.
<?php
/*---------------------
Dashboard Menu Adjustments
---------------------*/
// Only hide specific dashboard menu items on the live server.
// Show on localhost so we can control every component.
$whitelist = array('127.0.0.1','::1');
@tanmay27vats
tanmay27vats / script.js
Last active January 5, 2024 22:58
Custom Add to cart WooCommerce, Refresh fragments data, Refresh cart total items, Get product variation
product_add_to_cart : function(){
var ajx_data = {};
var ajx_grab = {};
$(document).on('change','.single-product .variations_form select',function(e){
var $this = $(this);
var pro_id = $(".single-product .variations_form").attr('data-product_id');
var attribute_name = $this.attr('data-attribute_name');
var attribute_value = $this.val();
var post_ajxurl = window.location+"?wc-ajax=get_variation";
@agirlandhermac
agirlandhermac / gravity-forms-material-design.css
Last active November 1, 2023 10:43
Styling Gravity Forms with Material Design Look
/*** MAIN WRAPPER ***/
.gform_wrapper {
background: #6000AA;
padding: 5%;
}
/*** REMOVE LABEL FOR PLACEHOLDER ONLY ***/
.gform_wrapper .top_label .gfield_label,
.gform_wrapper .field_sublabel_below .ginput_complex.ginput_container label {
display: none;
@dianjuar
dianjuar / How to make a WordPress plugin require another plugin.md
Last active July 18, 2023 19:27
Make a WordPress plugin dependent of another plugin

How to make WordPress a plugin require another plugin?

Put this function on the main php file of your dependent plugin and call it with the rigth parameters.

/**
 * Verify if a plugin is active, if not deactivate the actual plugin an show an error
 * @param  [string]  $my_plugin_name
 *                   The plugin name trying to activate. The name of this plugin
 *                   Ex:
@wpscholar
wpscholar / pantheon-wp-config.php
Last active March 26, 2021 05:34
My Pantheon wp-config.php template.
<?php
define( 'SITE_LIVE_DOMAIN', SITE_LIVE_DOMAIN );
define( 'WP_ENV', isset( $_ENV['PANTHEON_ENVIRONMENT'] ) ? $_ENV['PANTHEON_ENVIRONMENT'] : 'local' );
define( 'SCHEME', isset( $_SERVER['HTTP_USER_AGENT_HTTPS'] ) && $_SERVER['HTTP_USER_AGENT_HTTPS'] == 'ON' ? 'https' : 'http' );
// Redirect all traffic on live site to the correct domain
if ( 'live' === WP_ENV && php_sapi_name() !== 'cli' ) {
if ( $_SERVER['HTTP_HOST'] !== SITE_LIVE_DOMAIN ) {
form[data-drip-embedded-form] {
background: #fff url(data:image/gif;base64,R0lGODlhAQADAIABAMzMzP///yH/C1hNUCBEYXRhWE1QPD94cGFja…wbGhkYFxYVFBMSERAPDg0MCwoJCAcGBQQDAgEAACH5BAEAAAEALAAAAAABAAMAAAICRFIAOw==) repeat-y center top;
font-family: "Helvetica Neue", Helvetica, Arial, Verdana, sans-serif;
line-height: 1.5em;
overflow: hidden;
color: #666;
font-size: 16px;
border-top: solid 20px #3071b0;
border-top-color: #3071b0;
border-bottom: solid 10px #3d3d3d;
@glueckpress
glueckpress / wp-rocket-affiliatewp-cookies-cache.php
Last active March 26, 2019 21:24
[WordPress][WP Rocket] Creates cached files based on dynamic cookies for AffiliateWP. (WP Rocket 2.7+ required.)
<?php
/**
* Plugin Name: WP Rocket | AffiliateWP Cookie Cache
* Description: Creates a specific cache for each affiliate ref ID.
* Author: WP Rocket Support Team
* Author URI: http://wp-rocket.me/
* Plugin URI: https://gist.github.com/glueckpress/d379c5534708f440942523fe205ec840
* License: GNU General Public License v3 or later
* License URI: http://www.gnu.org/licenses/gpl-3.0.html
*/
@thenbrent
thenbrent / wcs-test-retry-rules.php
Last active September 8, 2020 14:02
WooCommerce Subscriptions Failed Payment Retry Rules for Testing: Replace the default WooCommerce Subscriptions failed payment retry rules with rules that run every few minutes (not days) and always send dunning emails to help with testing.
<?php
/**
* Plugin Name: WooCommerce Subscriptions Failed Payment Retry Rules for Testing
* Plugin URI:
* Description: Replace the default WooCommerce Subscriptions failed payment retry rules with rules that run every few minutes (not days) and always send dunning emails to help with testing.
* Author: Prospress Inc.
* Author URI: http://prospress.com/
* Version: 1.0
*
* Copyright 2016 Prospress, Inc. (email : freedoms@prospress.com)
$ = jQuery;
/*
* jQuery BBQ: Back Button & Query Library - v1.3pre - 8/26/2010
* http://benalman.com/projects/jquery-bbq-plugin/
*
* Copyright (c) 2010 "Cowboy" Ben Alman
* Dual licensed under the MIT and GPL licenses.
* http://benalman.com/about/license/
*/