Skip to content

Instantly share code, notes, and snippets.

View sirchrispy's full-sized avatar
🤔
Just doing my thing.

Chris Power sirchrispy

🤔
Just doing my thing.
View GitHub Profile
@sirchrispy
sirchrispy / update-deprecated-genesis-options.php
Created February 3, 2022 19:43
WordPress Plugin: Clear Out Genesis 2.6 Deprecated Fields (MultiSite Compatible)
<?php
/**
* Plugin Name: Update Deprecated Genesis Options
* Description: Clears out deprecated Genesis RSS options from Genesis < v2.6. Uninstall after activation.
* Version: 1.0.0
* Author: Chris Mower
* Author URI: https://thecookingdish.com
* License: GPL-2.0+
* License URI: http://www.gnu.org/licenses/gpl-2.0.txt
@sirchrispy
sirchrispy / wpcli-flywheel-cache-flush.php
Last active April 19, 2021 20:30 — forked from jtsternberg/wpcli-flywheel-cache-flush.php
Flush cache on Flywheel Local VM
<?php
/*
Plugin Name: Flywheel Flush Cache
Description: Flushes Local by Flywheel's cache, solving the problem of plugins showing multiple times. Drop this file in the mu-plugins folder
Version: 1.0.0
Author: jtsternberg
Author URI: https://gist.github.com/jtsternberg/03219ce49c882f20d862724e0e594c73
Text Domain: lbfw
Domain Path: /languages
@sirchrispy
sirchrispy / _README-update-wpms.txt
Last active January 29, 2021 18:57
Update WordPress MultiSite to New File Paths: Change blogs.dir to sites
/* INTRODUCTION
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
These instructions are for updating WordPress MultiSite to the new file paths.
It's written with a MultiSite that uses sub-directories, not sub-domains. But
with a few changes, you could easily use it for sub-domains.
If your WordPress MultiSite was installed prior to version 3.5, you're likely
using the old file path structure: blogs.dir.
@sirchrispy
sirchrispy / widgetized_archive_loop.php
Last active May 21, 2019 04:56
Creates a widget area and displays it after every X number of posts in a Genesis theme.
<?php
//* Do not copy the beginning <?php tag; place this code in your functions.php file
// Step 1: Modify the loop to accept an action hook
// Step 2: Create a widget area
// Step 3: Have the loop recognize the widget area
// Step 4: Place something in the new widget area to display
// Step 5: Style the area
/**
@sirchrispy
sirchrispy / _grid-loop.scss
Last active May 10, 2019 18:54
Create a grid loop with Genesis Framework, Flexbox, and Sass (Scss).
/**
* This code is strictly for layout and does not do any sort of
* beautification or extra styling. Each theme is different,
* so you'll need to do that on your own.
*
* If you'd rather use css, you can use a free tool like
* SassMeister to compile this code. (https://www.sassmeister.com/)
*/
// Easy Media Queries
@sirchrispy
sirchrispy / _ads.scss
Last active May 9, 2019 19:17
Website Ad Banner Sizes in HTML, SCSS, and CSS
/**
* This is a way to quickly add placeholders for
* popular ad sizes on the web using an html div
*/
// Define Ad Variables
$ad-background-color: #ccc;
$ad-text-color: #666;
$ad-base-font-size: 18px;
$ad-small-font-size: 12px;
@sirchrispy
sirchrispy / gist:46078436df5918070736935a88741c51
Created February 22, 2018 21:56 — forked from getdave/gist:4578295
Gravity Forms - custom field validation function for checkboxes. Ensures all checkboxes have been checked.
// Replace 7 with the ID of your form and 13 with the ID of the field you want to force "all required"
// http://www.gravityhelp.com/documentation/page/Gform_field_validation
add_filter("gform_field_validation_7_13", 'validate_tcs', 10, 4);
function validate_tcs($result, $value, $form, $field) {
// Convert the checkbox input name value (returned as part of "field")
// into the "underscored" ID version which is found in the $_POST
foreach ($field['inputs'] as $input) {
$input_post_value = 'input_' . str_replace('.', '_', $input['id']);
@sirchrispy
sirchrispy / functions.php
Last active November 30, 2017 00:14
Remove the Content Editor in WordPress and Genesis
<?php
add_action( 'do_meta_boxes', 'tcd_remove_content_editor' );
/**
* Remove content editor on some pages
*
* This is particularly useful for page templates and front pages. We hook into
* 'do_meta_boxes' because it manipulates already-registered meta boxes, firing
* after the 'add_meta_boxes' hook, but before the meta boxes are echoed.
*
@sirchrispy
sirchrispy / wpms-genesis-site-description.php
Created March 1, 2017 23:34
WordPress MultiSite and Genesis: Change Site Descriptions to Main Site Description
<?php
// Change header description for sub-sites to main site's description
add_filter( 'genesis_seo_description', 'tcd_change_header_description', 10, 3);
function tcd_change_header_description( $description, $inside, $wrap ) {
if ( is_main_site() ) {
$inside = esc_html( get_bloginfo( 'description' ) );
@sirchrispy
sirchrispy / wpms-genesis-header-urls.php
Created March 1, 2017 23:31
WordPress MultiSite and Genesis: Change Title Area URLs to main Site URL
<?php
// Change header URL for sub-sites to main site's URL
add_filter( 'genesis_seo_title', 'tcd_change_header_url', 10, 3 );
function tcd_change_header_url( $title, $inside, $wrap ) {
if ( is_main_site() ) {
$network_name = get_bloginfo( 'name' );
$network_url = get_bloginfo( 'url' );