Skip to content

Instantly share code, notes, and snippets.

View CapWebSolutions's full-sized avatar

Matt Ryan CapWebSolutions

View GitHub Profile
@CapWebSolutions
CapWebSolutions / sec-scan-v5.sh
Created January 3, 2020 01:07
Perform MainWP Security scan on all configured sites from terminal
#
# This script is executed from a terminal prompt at the root of your MainWP WordPress website
#
# Execute MainWP CLI command to generate a list of all configured sites in MainWP
# Pipe output through filter to remove columns 3 and 4 of output. These columns hold the 2 digit site number. Adjust if more than 99 sites.
# Pipe that output to get rid of the comment lines in the site listing.
# Pipe that output through the SED editor inserting the security scan command at the beginning of the line
# Send everything to a shell script to be executed.
wp mainwp sites | cut -c3-4 | grep -E '([0-9]|[0-9][0-9])' | sed 's/^/wp mainwp-sucuri scan /' > sec-scan-auto.sh
#
@CapWebSolutions
CapWebSolutions / Contract Killer 3.md
Created March 6, 2019 15:17
The latest version of my ‘killer contract’ for web designers and developers

Contract Killer

The popular open-source contract for web professionals by Stuff & Nonsense

  • Originally published: 23rd December 2008
  • Revised date: March 15th 2016
  • Original post

@CapWebSolutions
CapWebSolutions / .htaccess
Last active January 29, 2019 22:49
Harden folder from outside access
deny from all
@CapWebSolutions
CapWebSolutions / hide_the_author_rss.php
Created November 27, 2018 21:15
Remove author name from RSS feed.
/**
* Hide the author
*
* Hide the post author on the standard RSS feed if it matches a preset value.
*
* @link https://capwebsolutions.com
*
* @package WordPress
* @since 1.0.0
* @license GNU General Public License 2.0+
@CapWebSolutions
CapWebSolutions / 00-wordpress-debug.php
Last active August 3, 2021 20:18
[WordPress] Tools For WordPress Projects
<?php
define( 'WP_DEBUG', true );
define( 'WP_DEBUG_LOG', true );
define( 'WP_DEBUG_DISPLAY', true );
@ini_set( 'display_errors', 1 );
define( 'SCRIPT_DEBUG', true );
define( 'SAVEQUERIES', true );
@CapWebSolutions
CapWebSolutions / remove-IE-focus-outline.css
Created June 26, 2018 19:06
IE 10/11 displays outline on any clicked div. This css snippet removes that outline.
/* Added to remove outline on any clicked div when displyed in IE 11 */
@media all and (-ms-high-contrast: none), (-ms-high-contrast: active) {
/* IE10+ CSS styles go here */
:focus {
outline: none;
}
}
@CapWebSolutions
CapWebSolutions / phpinfo.php
Created June 22, 2018 23:06
Save file to root of website. Run example.com/phpinfo.php to see what PHP services are running. Delete file when done. Don't leave it on your serveer.
<?
phpinfo();
?>
@CapWebSolutions
CapWebSolutions / bust-it.php
Created June 18, 2018 16:33
Auto cache busitng on css and js based on file time stamp.
/**
* Never worry about cache again!
*/
function my_load_scripts($hook) {
// create my own version codes
$my_js_ver = date("ymd-Gis", filemtime( plugin_dir_path( __FILE__ ) . 'js/custom.js' ));
$my_css_ver = date("ymd-Gis", filemtime( plugin_dir_path( __FILE__ ) . 'style.css' ));
//
@CapWebSolutions
CapWebSolutions / gf-consent.php
Created June 4, 2018 16:35
Add text AFTER submit button on Gravity Forms form
@CapWebSolutions
CapWebSolutions / load-media-from-prod.sh
Last active September 21, 2018 19:10
Load media files from production server if they don't exist locally - htaccess tweak
# Load media files from production server if they don't exist locally
<IfModule mod_rewrite.c>
RewriteEngine on
RewriteCond %{REQUEST_URI} ^/wp-content/uploads/[^\/]*/.*$
RewriteRule ^(.*)$ https://<insert-production-sitedomain>/$1 [QSA,L]
</IfModule>
# Sep 2018 - Simplified using css-tricks.com recommendation
# Feb 2018 - verified working on local by flywheel