Skip to content

Instantly share code, notes, and snippets.

View morganestes's full-sized avatar

Morgan Estes morganestes

View GitHub Profile
@ashleyfae
ashleyfae / olark-in-wp.php
Created April 27, 2016 17:19
Integrates Olark with WordPress and Easy Digital Downloads by displaying user information.
<?php
/*
* Plugin Name: Olark In WP
* Plugin URI: https://www.nosegraze.com
* Description: Integrates Olark with WordPress and Easy Digital Downloads by displaying user information.
* Version: 1.0
* Author: Nose Graze
* Author URI: https://www.nosegraze.com
* License: GPL2
*
@danielbachhuber
danielbachhuber / cache-purge.php
Created February 22, 2016 17:34
Trigger Varnish cache purge on deploy to WP Engine
<?php
add_action( 'init', function(){
// Replace '901bcc678021c0e12f1583085cafda1d' with a secret of your own.
if ( ! empty( $_GET['purge-cache'] ) && '901bcc678021c0e12f1583085cafda1d' === $_GET['purge-cache'] ) {
WpeCommon::purge_varnish_cache_all();
echo 'Cache purged';
exit;
}
});
// paste in your console
speechSynthesis.onvoiceschanged = function() {
var msg = new SpeechSynthesisUtterance();
msg.voice = this.getVoices().filter(v => v.name == 'Cellos')[0];
msg.text = Object.keys(window).join(' ');
this.speak(msg);
};
@rtvenge
rtvenge / createSSHKey.sh
Created September 2, 2015 17:46
Create an SSH shortcut and key shell script.
#!/bin/bash
echo "Please enter username on server: "
read USER
echo "Please enter server host or IP address (ex: opticllc.com)"
read SERVER_HOST
echo "Please enter server name (aka ssh shortcut)"
read SERVER_NAME
@joshlevinson
joshlevinson / .bash_profile
Last active April 21, 2023 12:04
WP CLI + Xdebug
# Add this to /config/bash_profile
function wpd {
export XDEBUG_CONFIG="idekey=VVVDEBUG remote_connect_back=1"
wp "$@"
unset XDEBUG_CONFIG
};
# Run these commands:
# vagrant ssh
# sudo cp /srv/config/bash_profile /home/vagrant/.bash_profile
# source ~/.bash_profile
@tammyhart
tammyhart / traverse_results.php
Last active September 5, 2024 01:51
Traverse WordPress Search Results
<?php
/**
* Return search array
*/
function loopconf_search_array( $search_hash ) {
// check for existence of unique transient
if ( false === ( $search_array = get_transient( 'loopconf_search_' . $search_hash ) ) ) {
global $wpdb;
@TheHiddenHaku
TheHiddenHaku / console_log.php
Last active August 29, 2015 14:06
PHP - Function to log data in javascript console
<?php
//UTILITY TO CONSOLE LOG DEBUG OUTPUT
function console_log($data, $table = 0) {
$verb = $table ? 'table' : 'log';
if(is_array($data) || is_object($data)) {
echo "<script>console.".$verb."(".json_encode($data).");</script>" ;
} else {
echo "<script>console.".$verb."(".$data.");</script>" ;
}
}
@GaryJones
GaryJones / phpmd.xml
Created September 12, 2014 15:04
PHPMD Ruleset for a WordPress Theme
<?xml version="1.0"?>
<ruleset name="phpmd.xml"
xmlns="http://pmd.sf.net/ruleset/1.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://pmd.sf.net/ruleset/1.0.0 http://pmd.sf.net/ruleset_xml_schema.xsd"
xsi:noNamespaceSchemaLocation="http://pmd.sf.net/ruleset_xml_schema.xsd">
<description>PHPMD Ruleset for a WordPress Theme</description>
<rule ref="rulesets/cleancode.xml/BooleanArgumentFlag" />
<rule ref="rulesets/cleancode.xml/ElseExpression" />
<rule ref="rulesets/cleancode.xml/StaticAccess" />
@norcross
norcross / yoast-ga-menu-move.php
Last active August 29, 2015 14:06
move Yoast Google Analytics top-level nav to a sub menu
/**
* move the main settings page for Yoast Google Analytics
* from it's own parent menu into a submenu page in either
* the Yoast SEO menu or in the general settings
*
* @return null
*/
function rkv_yoast_ga_menu() {
// check for the Yoast GA class in the event the plugin