Skip to content

Instantly share code, notes, and snippets.

View EarthmanWeb's full-sized avatar

Terrance Orletsky EarthmanWeb

View GitHub Profile
@EarthmanWeb
EarthmanWeb / getwid-wcag-fixes.php
Last active July 18, 2024 00:42
Fixes WCAG Accessibility issues with Getwid Accordion to make it work with the tab key
<?php
/**
* Plugin Name: Accordion Accessibility Enhancements
* Description: Adds tab-index enhancements to Getwid accordion items for better accessibility.
* Version: 1.16
* Author: Terrance Orletsky / ChatGPT
*/
function em_add_inline_js_to_footer() {
?>
<script type="text/javascript" id="getwid-wcag">
@EarthmanWeb
EarthmanWeb / terminus-cli-test.php
Last active July 3, 2024 16:18
Terminus WP-CLI output test - place in /wp-content/mu-plugins
<?php
/**
* Plugin Name: Terminus Output Test
* Description: A WP-CLI command that counts to 250k with a 5 second wait per increment. Terminus is not passing WP-CLI output back to the terminal - As a result, the connection is closed after 10 minutes while the CLI command continues in the remote container with no way to stop it.
* Usage: terminus wp site.env --verbose -- terminus-output-test
* Version: 1.0
* Author: Terrance Orletsky / ChatGPT
*/
if ( defined( 'WP_CLI' ) && WP_CLI ) {
@EarthmanWeb
EarthmanWeb / collect-php-error-log-rsync.sh
Last active June 15, 2024 06:29
Aggregate logs from Pantheon server via Rsync
#!/bin/bash
# Usage from project root
# make sure your default public key (id_rsa.pub) is added to pantheon
# bash /path/to/bash/script/collect-php-error-log-rsync.sh
# ** put this in the folder you also want the '/logs' folder to land in
### SET SCRIPT PARAMS ###
# Site UUID is REQUIRED: Get from Pantheon Dashboard URL
SITE_UUID="12345678-1234-1234-abcd-0123456789ab"
@EarthmanWeb
EarthmanWeb / login-logo.php
Last active March 21, 2024 22:56
EM mu-plugin - no frills login customizer for WP
<?php
/**
* Plugin Name: EM Custom Login Logo and Styles
* Description: MU-Plugin - Customizes the login page with a custom logo and styles.
* Author: Terrance Orletsky / ChatGPT
* Version: 2.3.2
*/
add_action( 'login_enqueue_scripts', 'em_custom_login_styles' );
@EarthmanWeb
EarthmanWeb / plugin-versions.php
Last active January 17, 2024 16:38
Add a copy/pasteable plugin update list with quick links to changelogs in wp-admin
<?php
/**
* Plugin Name: Plugin Versions
* Description: Adds a Plugin Versions menu in WordPress Admin under Plugins.
* Author: Terrance Orletsky - Earthman Media
* Author URI: https://earthmanmedia.com
* Version: 1.0.4
*/
@EarthmanWeb
EarthmanWeb / gist:f2918d9b3cb7933b75a63bf9b5c217f3
Last active January 4, 2024 21:29
Custom WP caps for media library
function em_setup_media_permissions() {
add_filter( 'user_has_cap', 'em_grant_media_permissions_except_subscriber', 1000, 4 );
}
// add custom caps to enable media permissions for custom roles
function em_grant_media_permissions_except_subscriber( $allcaps, $caps, $args, $user ) {
$post_id = isset( $_REQUEST['post'] ) ? $_REQUEST['post'] : ( isset( $args[2] ) ? $args[2] : null );
if ( ! $post_id ) {
@EarthmanWeb
EarthmanWeb / og-meta-tags.php
Last active November 4, 2023 02:01
SEO / OG Meta Tags
<?php
/**
* Plugin Name: OG Meta Tags
* Description: Adds OG meta tags to the head of the document with dynamic default values.
* Version: 1.0.0
*/
/**
* Adds the SEO meta tags to the head of the document.
*
@EarthmanWeb
EarthmanWeb / wpms-plugin-list.php
Last active September 19, 2023 20:12
mu-plugin to show status of plugins for all sites in wpms (WordPress multisite)
<?php
/**
* Plugin Name: Plugins Enabled
* Description: Displays the plugin status across all sites in a WordPress Multisite network.
* Author: Terrance Orletsky - Earthman Media
* Author URI: https://earthmanmedia.com
* Version: 1.0.7
*/
add_action( 'network_admin_menu', 'wpms_plugin_list_menu' );
@EarthmanWeb
EarthmanWeb / wmcc-functions.php
Created September 13, 2023 22:30
TEC 6 fix for WordPress Multisite Content Copier/Updater Pro v3
<?php
if ( ! defined( 'ABSPATH' ) ) {
exit( 'restricted access' );
}
/*
* This is a function that show copier section.
* Show multisite relationships.
*/
if ( ! function_exists( 'wmcc_display_content_copier' ) ) {
@EarthmanWeb
EarthmanWeb / plugin-status.php
Last active September 15, 2023 23:00
Adds plugin status page to network admin for WPMS
<?php
/**
* Plugin Name: Plugin Versions
* Description: Adds a Plugin Versions menu in WordPress Network Admin under Plugins.
* Author: Terrance Orletsky - Earthman Media
* Author URI: https://earthmanmedia.com
* Version: 1.0
*/