Skip to content

Instantly share code, notes, and snippets.

Emojifying commits.

Seth Carstens scarstens

Emojifying commits.
Block or report user

Report or block scarstens

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
scarstens /
Last active Mar 26, 2019
Lando Initializer
lando init --recipe=wordpress --webroot=. --option via=nginx --option php=7.2 --option database=mariadb --option xdebug=true --source=cwd --name=osp
lando start
lando wp core download
lando wp config create --dbname=wordpress --dbuser=wordpress --dbpass=wordpress
lando wp core install --quiet --admin_email="" --title="LandoSite" --admin_user=admin --admin_password=password --url=
lando wp theme delete twentythirteen ; lando wp theme delete twentyfourteen; lando wp theme delete twentyfifteen; lando wp theme delete twentysixteen; lando wp plugin delete hello; lando wp plugin delete akismet;;
scarstens / vvv-nginx-image-fallback-prod.conf
Created Jun 21, 2018
Nginx configuration based on FanSided's local development shows has to setup nginx fallback for images that exist in production, so that you don't need to download them locally.
View vvv-nginx-image-fallback-prod.conf
#matches all .dev TLDs
log_format main 'MAIN: $remote_addr - $remote_user [$time_local] '
'"$request" $status $body_bytes_sent '
'"$http_referer" "$http_user_agent" "$gzip_ratio"';
log_format wpc 'WPCONTENT: $remote_addr - $remote_user [$time_local] '
'"$request" $status $body_bytes_sent '
'"$http_referer" "$http_user_agent" "$gzip_ratio"';
log_format PROXY 'PROXY: $remote_addr - $remote_user [$time_local] '
scarstens / sunrise.php
Created Aug 23, 2017
View sunrise.php
if (!empty($_SERVER['HTTP_HOST']))
$site = get_site_by_path(strtolower($_SERVER['HTTP_HOST']), '/');
define('COOKIE_DOMAIN', '.'.$site->domain);
scarstens / class-an-injected-network-site-option.php
Created Jan 11, 2017
Site option example of injecting new section and fields into existing sm_options_page or sm_options_container from the fansided-vip plugin
View class-an-injected-network-site-option.php
* Plugin Name: an-injected-network-site-option
* Description: Site option example of injecting new section and fields into existing sm_options_page or sm_options_container from the fansided-vip plugin
* Plugin URI:
* Author: sethcarstens
* Author URI:
* Version: 0.0.1
* Text Domain: fs
* License: GPLv2 or later
scarstens / sunrise.php
Created Apr 18, 2016
Custom sunrise for TLD wordpress multisite in 1 file
View sunrise.php
if ( !empty( $_SERVER['HTTP_HOST'] ) ) {
$site = get_site_by_path( strtolower( $_SERVER['HTTP_HOST'] ), '/');
define( 'COOKIE_DOMAIN', '.' . $site->domain );
scarstens / fix-dynamic-zindex-hoarders.js
Created Jun 27, 2015
Javascript snippet should be loaded "on page load" and it should attach itself to any elements on the page that are abusing z-index (anything over 999) and brings them back down to 99 by building a style element after the element found. Does not fix elements with inline !important styles, which are impossible to override.
View fix-dynamic-zindex-hoarders.js
//todo: needs to somehow use the .on function to attach to elements created after pageload
jQuery('[style*="z-index"]').each(function() {
var zi = $(this).css("z-index");
if(zi > 999){
newstyle = jQuery('<style class="zindex2big" type="text/css"> #''{ z-index=99 !important;} </style>').insertAfter(this);
scarstens / xml_entities.function.php
Created Apr 10, 2015
Function to use with SimpleXML that allows you to properly encode all XML values, use in an example like $setting->addChild( $name, xml_entities($v) );
View xml_entities.function.php
//for use with SimpleXML objects
//ie $setting->addChild( $name, xml_entities($v) );
if(!function_exists('xml_entities')) {
function xml_entities( $string ) {
return strtr(
"<" => "&lt;",
">" => "&gt;",
scarstens / remove-action-by-class.function.php
Created Mar 5, 2015
remove_action_by_class - Remove actions that are created in WordPress by the add_action hook, but can't be removed with the remove_action hook because an instance of a class created the hook with no way to access it. Use to remove custom actions created by class instances.
View remove-action-by-class.function.php
* Function remove_action_by_class
* Used to remove notices and nags or other class actions added with class instances (unable to remove with remove_action)
* @param $hook_name
* @param $class_and_function_list
* @param int $priority
* ex use case:
scarstens / function-override-with-class.test.php
Created Feb 21, 2015
Example of overriding a "root level" function using a custom class. The example showcases how to override WordPress's pluggable.php function wp_mail, with a custom function.
View function-override-with-class.test.php
class wpMandrill{
static function load(){
function wp_mail(){
echo 'custom mail';
scarstens / load-plugin-last.partial.php
Created Dec 20, 2014
Use this in your plugin to make sure it loads last
View load-plugin-last.partial.php
function my_plugin_load_last()
$path = str_replace( WP_PLUGIN_DIR . '/', '', __FILE__ );
if ( $plugins = get_option( 'active_plugins' ) ) {
if ( $key = array_search( $path, $plugins ) ) {
array_splice( $plugins, $key, 9999 );
array_unshift( $plugins, $path );
update_option( 'active_plugins', $plugins );
You can’t perform that action at this time.