Skip to content

Instantly share code, notes, and snippets.

View bhubbard's full-sized avatar
:octocat:
Hello

Brandon Hubbard bhubbard

:octocat:
Hello
View GitHub Profile
@bhubbard
bhubbard / wpe_heartbeat.php
Created June 1, 2016 20:37 — forked from joshfeck/wpe_heartbeat.php
DE-disallows WPEngine's disallowing of the WordPress Heartbeat API
<?php
//* Please do NOT include the opening php tag, except of course if you're starting with a blank file
add_filter( 'wpe_heartbeat_allowed_pages', 'my_wpe_add_allowed_pages' );
function my_wpe_add_allowed_pages( $heartbeat_allowed_pages ) {
$heartbeat_allowed_pages = array(
'index.php',
'admin.php',
'edit.php',
@bhubbard
bhubbard / infinitewp.sql
Created June 1, 2016 17:27 — forked from remcotolsma/infinitewp.sql
Queries to delete InfiniteWP site history and stats of deleted sites.
DELETE FROM iwp_history WHERE siteID NOT IN ( SELECT siteID FROM iwp_sites );
DELETE FROM iwp_history_additional_data WHERE historyID NOT IN ( SELECT historyID FROM iwp_history );
DELETE FROM iwp_history_raw_details WHERE historyID NOT IN ( SELECT historyID FROM iwp_history );
DELETE FROM iwp_site_stats WHERE siteID NOT IN ( SELECT siteID FROM iwp_sites );
DELETE FROM iwp_user_access WHERE siteID NOT IN ( SELECT siteID FROM iwp_sites );
#!/bin/bash
echo -n "GitHub User: "
read USER
echo -n "GitHub Password: "
read -s PASS
echo ""
echo -n "GitHub Repo (e.g. imFORZA/REPO): "
@bhubbard
bhubbard / codeship.io.yml
Created May 17, 2016 21:47 — forked from thanhluu/codeship.io.yml
Test WordPress Theme from Bitbucket on Codeship
cd ..
# Install CodeSniffer for WordPress Coding Standards checks.
git clone https://github.com/squizlabs/PHP_CodeSniffer.git php-codesniffer
# Install WordPress Coding Standards.
git clone https://github.com/WordPress-Coding-Standards/WordPress-Coding-Standards.git wordpress-coding-standards
# Hop into CodeSniffer directory.
cd php-codesniffer
# Set install path for WordPress Coding Standards
scripts/phpcs --config-set installed_paths ../wordpress-coding-standards
# After CodeSniffer install you should refresh your path.
TARGET=/path/to/theme
USER=deployuser
SERVER=ip.or.domain
PORT=port
cd ~/clone/
find . -type f -iname \*.coffee -delete
find . -type f -iname \*.scss -delete
find . -type f -iname \*.less -delete
find . -type f -iname \*.scssc -delete
find . -name .sass-cache -type d -exec rm -r {} +
REMOTE_REPOSITORY=${REMOTE_REPOSITORY:?'You need to configure the REMOTE_REPOSITORY environment variable!'}
REMOTE_BRANCH=${REMOTE_BRANCH:?'You need to configure the REMOTE_BRANCH environment variable!'}
set -e
git fetch --unshallow || true
git push ${REMOTE_REPOSITORY} ${CI_COMMIT_ID}:${REMOTE_BRANCH}
cd wp-content/themes/<theme>
npm install -g bower gulp
npm install
bower install
gulp --production
@bhubbard
bhubbard / gist:79855789f836cc6f235a454ef795ec59
Created May 17, 2016 21:44 — forked from bigdawggi/gist:a4eb094faa213c3a1297
Codeship Custom Deploy Script for WPEngine
# You must set up two environment variables:
# repoSlug = slug for WP Engine repository
# themeDir = path from the top of the repository, to the theme directory
git remote add production [email protected]:production/${repoSlug}.git
git remote add staging [email protected]:staging/${repoSlug}.git
cd ${themeDir}
npm install
npm install -g bower
bower install
@bhubbard
bhubbard / disable-jetpack-modules.php
Created April 25, 2016 20:27 — forked from robneu/disable-jetpack-modules.php
Disable unwanted Jetpack Modules. The whitelist array will allow any modules you want to remain enabled to continue to function. If you don't want the module to activate, remove it from the whitelist.
<?php
add_filter( 'jetpack_get_available_modules', 'prefix_hide_jetpack_modules' );
/**
* Disable all non-whitelisted jetpack modules.
*
* As it's written, this will allow all of the currently available Jetpack
* modules to work display and be activated normally.
*
* If there's a module you'd like to disable, simply comment it out or remove it
* from the whitelist and it will no longer be available for activation.
@bhubbard
bhubbard / plugin.php
Created April 8, 2016 00:47 — forked from jeherve/plugin.php
[Jetpack] Add a default fallback image if no image can be found in a post
<?php
/*
* Plugin Name: Jetpack default image
* Plugin URI: http://wordpress.org/extend/plugins/
* Description: Add a default fallback image if no image can be found in a post
* Author: Jeremy Herve
* Version: 1.0
* Author URI: http://jeremyherve.com
* License: GPL2+
*/
<?php
/*
Disable Dify
*/
add_action( 'admin_init', 'wpe_disable_dashboard_widgets', 9999 );
function wpe_disable_dashboard_widgets() {
remove_meta_box('dashboard_primary', 'dashboard', 'core'); // WordPress News Widget
remove_meta_box('wpe_dify_news_feed', 'dashboard', 'normal'); // WPEngine News Widget
}