Skip to content

Instantly share code, notes, and snippets.

View CapWebSolutions's full-sized avatar

Matt Ryan CapWebSolutions

View GitHub Profile
@CapWebSolutions
CapWebSolutions / wootweak-styles.php
Created April 29, 2021 15:22
Manage WooCommerce styles and scripts to get a performance boost.
<?php
add_action( 'wp_enqueue_scripts', 'capweb_woocommerce_style_cleaner', 99 );
/**
* Manage WooCommerce styles and scripts to get a performance boost.
* ref: https://docs.woocommerce.com/document/disable-the-default-stylesheet/
* Added 4/30/21
*/
function capweb_woocommerce_style_cleaner() {
// Unless we're in the store, remove all the stuff!
@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 / gist:2b63d27439fe7a984553dcdb351ff265
Created January 4, 2021 16:05
Don't forget to add alt tag to images
/* Don't forget to add alt tag to images
*/
img:not([alt]){
border: 5px solid red;
}
@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');
@CapWebSolutions
CapWebSolutions / add-cta-on-category.php
Created June 5, 2020 16:29
Add custom content to WooCommerce Thank You page is order has item of specific category.
/**
* WooCommerce add text to the thank you page to direct online class order to book class
*/
add_action( 'woocommerce_thankyou', 'wsm_add_content_thankyou');
function wsm_add_content_thankyou( $order_id ) {
$cat_in_order = false;
$order = wc_get_order( $order_id );
$order_items = $order->get_items();
@CapWebSolutions
CapWebSolutions / .gitignore
Last active April 14, 2020 16:15
Project starter .gitignore file for Cap Web Solutions projects
# -----------------------------------------------------------------
# .gitignore for WordPress @capwebsolutions
# ver 20200413
# Forked from salcode ver 20170228
#
# From the root of your project run
# curl -O https://gist.githubusercontent.com/CapWebSolutions/91abad7201ca8ec092e558c15691bd62/raw/.gitignore
# to download this file
#
# By default all files are ignored. You'll need to whitelist
@CapWebSolutions
CapWebSolutions / add-anchor-text.php
Created March 16, 2020 16:20
Replace naked anchor text in event urls with generic text to appease SEMRush 'missing anchor text' test. Updates event website, venue website and organizer website links.
<?php
/**
* Add Anchor Text To Event Website
*
* REpalce naked URL on event details website with generic Visit Website anchor text for SEO purposes.
*
* @link https://capwebsolutions.com
*
* @package WordPress
* @since 1.0.0
@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 / 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 — forked from malarkey/Contract Killer 3.md
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