Skip to content

Instantly share code, notes, and snippets.

@skipshean
skipshean / dark-mode.html
Created April 21, 2022 14:57
Dark Mode snippet for emails
<!-- Source: https://litmus.com/community/snippets/233-dark-mode-support -->
<!-- Put both of these sections in the <head> of your email. -->
<!-- Enable Dark Mode Support -->
<meta name="color-scheme" content="light dark">
<meta name="supported-color-schemes" content="light dark only">
<style type="text/css">
:root {
color-scheme: light dark;
@skipshean
skipshean / async-js.php
Created August 30, 2018 18:25
Load Wordpress jQuery asynchronously - insert in WP functions.php file
/*Function to defer or asynchronously load scripts*/
function js_async_attr($tag){
# Do not add defer or async attribute to these scripts
$scripts_to_exclude = array('jquery.js', 'script2.js', 'script3.js');
foreach($scripts_to_exclude as $exclude_script){
if(true == strpos($tag, $exclude_script ) )
return $tag;
}
@skipshean
skipshean / parse-email.js
Created May 7, 2018 18:26
Parse email address from URL parameter = email
<!-- Parse email address from URL parameter = email -->
<script>
var mail = document.querySelector('input#email_address');
if (mail) {
var t = document.location.href.split('?')[1];
if (t) {
var params = {};
var lst = t.split('&'), l = lst.length;
for (var i = 0; i < l; i++) {
var p = lst[i].split('=');
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>Your Page</title>
<meta http-equiv="refresh" content="0;URL='http://URLexample.com/'" />
</head>
<body>
<p>This page has moved to a <a href="http://URLexample.com/">
URLexample.com</a>.</p>
</body>
</html>
@skipshean
skipshean / remove-wc-sidebar-divi
Created December 21, 2016 02:38
Remove the sidebar in Divi theme WooCommerce pages
/*=====[ Divi Theme hide sidebar on WooCommerce product and shop pages ]=====*/
.woocommerce-page #left-area {
padding-right: 0 !important;
width: 100%;
}
.woocommerce-page #sidebar {
display: none;
}
.woocommerce-page #main-content .container::before {
@skipshean
skipshean / wp-config-optimizations
Last active January 6, 2020 17:55
WordPress config optimizations, place in wp-config.php file for optimal performance
// other general wordpress optimizations, place in wp-config.php file before "That's all, stop editing!" line.
define('WP_DEBUG', false);
define('WP_POST_REVISIONS', 5);
define('AUTOSAVE_INTERVAL', 600);
define( 'EMPTY_TRASH_DAYS', 3 );
define('WP_MEMORY_LIMIT','96M');
define( 'WP_MAX_MEMORY_LIMIT', '128M' );
// optional, remove this comment and the // below if you want to limit external requests in admin screens
@skipshean
skipshean / heartbeat-limit
Last active March 12, 2022 07:01
Limit or disable wordpress heartbeat to help speed up admin screens. Please in functions.php file.
// Limit or restrict WordPress heartbeat to speed up wp-admin when many browser tabs are open or traffic is high
// Taken from http://wordpress.stackexchange.com/questions/166727/how-can-i-speed-up-my-wp-admin-section
function optimize_heartbeat_settings( $settings ) {
$settings['autostart'] = false;
$settings['interval'] = 60;
return $settings;
}
add_filter( 'heartbeat_settings', 'optimize_heartbeat_settings' );
@skipshean
skipshean / Suppress CF Affiliate badge
Created September 8, 2016 00:35
don't display the clickfunnels affiliate badge on page - overrides the drop down menu that doesn't work
.nodoBadge {
display: none !important;
}
@skipshean
skipshean / fblead-click
Created June 19, 2016 16:42
onClick script to fire facebook ad lead when not going to a thank you page next
<script>
$(function () {
$('[href="#submit-form"]').click(function (ev) {
fbq('track','Lead');
});
});
</script>
<!-- parse email variable from url, load in header -->
<script>
function GetUrlValue(VarSearch) {
var SearchString = window.location.search.substring(1);
var VariableArray = SearchString.split('&');
for (var i = 0; i < VariableArray.length; i++) {
var KeyValuePair = VariableArray[i].split('=');
if (KeyValuePair[0] == VarSearch) {
return KeyValuePair[1];
}