Skip to content

Instantly share code, notes, and snippets.

View heyfletch's full-sized avatar
🏠
Working from home

Joe Fletcher heyfletch

🏠
Working from home
View GitHub Profile
@heyfletch
heyfletch / click-scroll.js
Last active March 3, 2022 14:54
jQuery On Click Scroll to Element and Click
jQuery(function($){ // use $
let myClick = 'a[href^="#guidelines"]';
let myTarget = '#elementor-tab-title-1356';
let mySpeed = 'fast';
let myOffset = 20;
$(myClick).click(function() {
let toScroll = $(myTarget).offset().top - myOffset;
$(myTarget).click();
$('html, body').animate({scrollTop: toScroll}, mySpeed);
@heyfletch
heyfletch / fd_purge_all_cache.php
Created January 27, 2022 18:53
Purge Multiple WordPress Caches in Ideal Order
<?php
// Clears Page Cache at key moments, e.g., after plugin updates
// Importantly, it clears the page when WP Rocket clears cache
// If Cloudflare page caching is enabled, this clears the nginx page cache before Cloudflare's cache
add_action( 'before_rocket_clean_domain', 'fd_purge_all_cache', 10, 0 ); // Before WP Rocket Cache
add_action( 'upgrader_process_complete', 'fd_purge_all_cache', 10, 0 ); // After plugin updates
add_action( 'activated_plugin', 'fd_purge_all_cache', 10, 0 ); // After plugin activated, doesn't work?
add_action( 'deactivated_plugin', 'fd_purge_all_cache', 10, 0 ); // After plugin deactivated, broken?
/* Update here: https://gist.github.com/heyfletch/8f5931292d3148bb64bc6e5e3a0235bc/ */
#wp-admin-bar-happy-addons,
.googlesitekit-cta,
#footer-left,
#cpt_info_box,
.notice.elementor-message,
div#autoptimize_admin_feed,
a[href="?page=ao_partners"],
#c2c,
"files.exclude": {
"wp-admin/": true,
"wp-includes/": true,
"index.php": true,
"license.txt": true,
"readme.html": true,
"wp-activate.php": true,
"wp-blog-header.php": true,
"wp-comments-post.php": true,
"wp-config-sample.php": true,
git archive --output="../plugin-name.zip" HEAD
# files to exclude, put in .gitattributes in the root dir. Syntax:
# /.gitattributes export-ignore
# /.gitignore export-ignore
# /LICENSE export-ignore
# /README.md export-ignore
@heyfletch
heyfletch / .gitignore
Last active July 5, 2020 14:31
WordPress Gitignore
#Theme Specific
#wp-content/themes/fletcherdigital/assets/css/main.min.css.map
# General
_notes
.cvs
.DS_Store?
.gitattributes
.htaccess
<?php
/*
Plugin Name: FD WP Migrate DB Pro Tweaks
Plugin URI: https://gist.github.com/heyfletch/7c563c418cc23b224af161eb5baea408
Description: Migration tweaks when running WP Migrate DB Pro
Author: Delicious Brains, Fletcher Digital
Version: 0.2.1
Author URI: https://github.com/deliciousbrains/wp-migrate-db-pro-tweaks
*/
<?php
/*
Plugin Name: Deactivate Plugins in Development
Plugin URI: https://gist.github.com/heyfletch/07a3677f69f94a02aaa02621075e5d6e
Description: Create a list of plugins to deactivate on local development. Doesn't effect production plugins.
Author: Fletcher Digital
Version: 0.1
Author URI: https://fletcherdigital.com
*/
@heyfletch
heyfletch / fd-clear-elementor-cache.php
Last active February 14, 2022 14:14
Clear Elementor Cache After a WP Migrate DB Pro Migration - Must Use Plugin (mu-plugins)
<?php
/*
Plugin Name: FD Clear Elementor Cache After WP Migrate DB Migration
Plugin URI: https://gist.github.com/heyfletch/769c64ad1fab8679032b076433afafd1
Description: Deletes CSS in uploads/elementor/css, which auto-regenerates on pageload. This clears the cache locally and remotely. Must-use plugin (mu-plugin).
Author: Fletcher Digital
Version: 0.1.1
Author URI: https://fletcherdigital.com
*/
@heyfletch
heyfletch / make-elementor-default-editor.php
Last active September 26, 2021 14:50
Make Elementor the Default Editor, Not the WordPress Editor (Gutenberg or Classic)
<?php
/**
* Make Elementor the default editor, not the WordPress Editor (Gutenberg or Classic)
* Clicking the page title will take you to the Elementor editor directly
* Even non-Elementor-edited pages will become Elementor-edited pages now
* You can revert by clicking the "Back to WordPress Editor" button
*
* Author: Joe Fletcher, https://fletcherdigital.com
* URL: https://gist.github.com/heyfletch/7c59d1c0c9c56cbad51ef80290d86df7