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-root.sh
Last active April 23, 2024 15:47
Latest iteration of security scanning script for MainWP instance.
#
# This script is executed from a terminal prompt at the root of your MainWP WordPress website.
# It uses the same services as WP CLI, so if WP CLI runs, this should also.
#
# 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.
cd /var/www/capwebwpcare.com/htdocs
@CapWebSolutions
CapWebSolutions / .gitignore
Last active April 18, 2024 14:22
Default gitignore for plugins
# -----------------------------------------------------------------
# .gitignore for WordPress plugins
# ver 20240417
#
# To ignore uncommitted changes in a file that is already tracked, use
# git update-index --assume-unchanged
#
# To stop tracking a file that is currently tracked, use
# git rm --cached
#
@CapWebSolutions
CapWebSolutions / .gitignore
Last active April 18, 2024 14:13
Default .gitignore - Combo @salcode & wpengine. Use this one when all plugins & theme are in single repo.
# -----------------------------------------------------------------
# .gitignore for WordPress @CapWebSolutions forked from @salcode
# ver 20211109
#
# From the root of your project run
# curl -O https://gist.github.com/CapWebSolutions/f22e8df8567070412dbcc5284218dcd5/raw/.gitignore
# to download this file
#
# By default all files are ignored. You'll need to whitelist
# any mu-plugins, plugins, or themes you want to include in the repo.
@CapWebSolutions
CapWebSolutions / capweb-screaming-frog-url-rewriting.txt
Last active March 15, 2022 14:42
Rules for basic WordPress URL rewriting in Screaming Frog.
/**
* WordPress URL rewriting rules for Screaming Frog Spider
* @author Matt Ryan - https://capwebsolutions.com
* @date 2022-03-15
*/
// Nav: Configuration | URL Rewriting
// Replacing:
// https://example/com/blog/page/2/
@CapWebSolutions
CapWebSolutions / capweb-screaming-frog-excludes.txt
Created March 15, 2022 14:41
Starting list of URLs to exclude when creating Screaming Frog config file for WordPress site.
/**
* WordPress URL Exclude List for Screaming Frog Spider
* @author Matt Ryan - https://capwebsolutions.com
* @date 2022-03-15
*/
// Nav: Configuration | Exclude
// Gets rid of:
// wp-content plugins, themes, mu-plugins, uploads, etc.
@CapWebSolutions
CapWebSolutions / dump-timezone.php
Last active September 22, 2021 20:15
Dump timezone in admin for debuging
add_filter('admin_menu','dump_timezone_choice');
function dump_timezone_choice($my_data) {
$my_data = wp_timezone_string();
var_dump($my_data);
return($my_data);
}
@CapWebSolutions
CapWebSolutions / the_copyright_year.php
Created September 16, 2021 20:34
Shortcode to insert in footer for auto adjusting copyright year. Tested in Elementor.
@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 / fullyear.js
Created February 20, 2020 17:44
Write out curent year in HTML page
<script>document.write( new Date().getFullYear() );</script>
@CapWebSolutions
CapWebSolutions / gist:71470cf053a2f1cb37534d49793d4426
Created January 4, 2021 16:02
Create copyright shortcode for use in footer
/*
* Usage
* Use [year] in your posts.
*/
function year_shortcode() {
$year = date('Y');
return $year;
}
add_shortcode('year', 'year_shortcode');