Skip to content

Instantly share code, notes, and snippets.

View mrcave's full-sized avatar

Denny Cave mrcave

View GitHub Profile
@mrcave
mrcave / block_ultimo_http_requests.php
Created May 17, 2024 15:44
Block requests to WP Ultimo's licensing servers
<?php
// WP Ultimo's licensing servers have gone offline and are causing
// customer networks to have long load times or error out completely.
// Blocking the requests to Ultimo's servers resolves this issue.
//
// H/T Calvin Alkan for suggesting http request filtering as a possible solution
add_filter('pre_http_request', 'block_ultimo_http_requests', 10, 3);
function block_ultimo_http_requests($preempt, $parsed_args, $url) {
@mrcave
mrcave / clear_cache_when_stock_changes.php
Last active October 25, 2023 12:12
Clear NGINX page cache when WooCommerce product inventory levels are changed (only tested on GridPane with Redis page caching enabled)
//clear entire cache when stock is reduced or replenished
function clear_cache_when_stock_changes( $order ) {
if(class_exists('PhpRedis_Purger') || class_exists('Predis_Purger')){
global $nginx_purger;
$nginx_purger->purge_all();
}
}
@mrcave
mrcave / replace-divi-mobile-dropdown-functions.js
Created October 9, 2020 03:35
Replace default mobile dropodown events in Divi
// Default Divi mobile menu dropdown events weren't working for us (didn't want the slideDown/Up functionality),
// so replaced it with our own events. We actually opted to use the .closed/.opened classes to hide and show our
// nav, but this snippet is a complete drop-in replacement for Divi's mobile dropdowns without needing additional CSS.
//unbind existing events on the mobile nav toggle
jQuery('.mobile_nav').off();
jQuery(".mobile_menu_bar").click(function(event){
e = jQuery(this);
s = jQuery(this).closest('.mobile_nav');
@mrcave
mrcave / phpmailer.php
Last active September 24, 2020 03:23
WordPress multisite PHP mailer override for use with transactional email service
<?php
//this file goes in /wp-content/mu-plugins
//https://gist.github.com/butlerblog/c5c5eae5ace5bdaefb5d
//constant configs in wp-config.php
add_action( 'phpmailer_init', 'use_smtp_email' );
function use_smtp_email( $phpmailer ) {
@mrcave
mrcave / app_delegate.rb
Created June 26, 2013 04:00
ProMotion MotionModel incompatibility
class AppDelegate < PM::Delegate
attr_reader :window
def on_load(app, options)
open ListEntriesScreen.new(nav_bar: true)
end
end
@mrcave
mrcave / css.css
Last active December 12, 2015 03:38
Example of implementing bigPostTarget plugin.
.blogList > ul > li{
border:1px solid transparent;
}
.blogList > ul > li.hover{
cursor: pointer;
background: #F6F6F6;
border: 1px solid #EEE;
}
@mrcave
mrcave / font-family.html
Last active December 11, 2015 01:08
Implementing Google web fonts in your LightCMS projects
<style type="text/css">
h1, h2, h3, h4, h5, h6 {
font-family: 'Mouse Memoirs', Trebuchet, Tahoma, Arial, sans-serif;
}
</style>
@mrcave
mrcave / head.html
Created January 7, 2013 23:10
Adding an event countdown to the calendar element
<script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/jqueryui/1.8.13/jquery-ui.min.js"></script>
<script type="text/javascript" src="/assets/js/xdate.0.7.min.js"></script>
@mrcave
mrcave / embed.html
Created January 7, 2013 22:57
Properly using Google Hosted Libraries
<script src="//ajax.googleapis.com/ajax/libs/jquery/1.8.3/jquery.min.js"></script>
@mrcave
mrcave / information.html
Last active December 10, 2015 19:08
5 secrets for building a powerful members-only area
<a href="/contact?field_92375_1015030=[first]&field_92375_1015031=[last]&field_92375_1015032=[email]">Contact us</a>