Skip to content

Instantly share code, notes, and snippets.

View bigdawggi's full-sized avatar

Matthew Richmond bigdawggi

  • Bigdawggi Co
  • Island Park, ID
View GitHub Profile
@bigdawggi
bigdawggi / gist:b5e241ab7ead9f626c1c
Created June 26, 2015 20:21
Business Structured Data Example
<script type="application/ld+json">
{
"@context": "http://schema.org",
"@type": "SportingGoodsStore",
"openingHours": "Mo,Tu,We,Th,Fr,Sa,Su 08:00-18:00",
"url": "https://www.example.com/",
"logo": "https://www.example.com/logo.png",
"address": {
"@type": "PostalAddress",
"addressLocality": "Example City",
@bigdawggi
bigdawggi / gist:9db55d2e358aaa0259e9
Last active August 29, 2015 14:22
Trigger events on non-DOM objects
foo = {}
jQuery(foo).on('bar', function(){ alert('hey') })
jQuery(foo).trigger('bar')
@bigdawggi
bigdawggi / addwpremote.sh
Created May 20, 2015 17:45
Clones github repos and fetches WPEngine staging and production repos - then adds wpremote
#!/bin/bash
cd /installs/
echo -e "Please enter the repository name for the Github repo (Example: angelfire): \c "
read GITHUBSLUG
git clone git@github.com:TMBR/${GITHUBSLUG}.git
cd ${GITHUBSLUG}
echo -e "Please enter the WPEngine Install name (Example: angelfireresor): \c "
read WPESLUG
git remote add staging git@git.wpengine.com:staging/${WPESLUG}.git
git remote add production git@git.wpengine.com:production/${WPESLUG}.git
@bigdawggi
bigdawggi / gist:40d56ee4190e889fde7b
Last active August 29, 2015 14:21
admin-ajax call
<?php
function get_user_snippet(){
$id = intval( $_GET['user_id'] );
global $post;
$post = get_post( $id );
setup_postdata( $post );
get_template_part( 'partials/user-snippet');
exit;
}
@bigdawggi
bigdawggi / gist:5360aebfdcad25c995e9
Created April 21, 2015 23:11
WPSEO Stop annoying redirect on update
diff --git a/wp-content/plugins/wordpress-seo/index.php b/wp-content/plugins/wordpress-seo/index.php
index 12c197f..abebf2a 100644
--- a/wp-content/plugins/wordpress-seo/index.php
+++ b/wp-content/plugins/wordpress-seo/index.php
@@ -1,2 +1,9 @@
<?php
-//Nothing to see here
\ No newline at end of file
+//Nothing to see here
+
@bigdawggi
bigdawggi / gist:a4eb094faa213c3a1297
Created March 25, 2015 23:52
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 git@git.wpengine.com:production/${repoSlug}.git
git remote add staging git@git.wpengine.com:staging/${repoSlug}.git
cd ${themeDir}
npm install
npm install -g bower
bower install
@bigdawggi
bigdawggi / gist:0189460108f3c2060f5b
Created March 20, 2015 16:24
Search with pretty permalinks
(function($){
$(function(){
$('#search-form').on('submit', function(e){
e.preventDefault();
var searchBox = $(this).find('input[type=search]'),
searchTerm = '';
if(searchBox.length === 0) {
alert('No search term available');
return false;
@bigdawggi
bigdawggi / gist:896c225e49dd0bc52d55
Last active August 29, 2015 14:15
Database Table Size Query
SELECT
table_name AS "Tables",
round(((data_length + index_length) / 1024 / 1024), 2) "Size in MB"
FROM information_schema.TABLES
WHERE table_schema = "wp_mysitenamegoeshere"
ORDER BY (data_length + index_length) DESC
limit 10;
@bigdawggi
bigdawggi / gist:1d58d946bf2f00b34b9d
Created February 3, 2015 22:31
Code to utilize the newly-created wp_cron schedule
// Add the action or social posts deleting
add_action( 'social_delete_posts', function() {
$args = array(
'post_type' => 'social_posts',
'post_status' => 'any',
'posts_per_page' => -1,
'date_query' => array(
array(
'column' => 'post_date_gmt',
'before' => '1 month ago',
@bigdawggi
bigdawggi / gist:c4edae91da16367735f6
Created February 3, 2015 22:30
Code to schedule a cron to run at a certain local time
add_action( 'init', function() {
/* must have this check here, b/c although a new cron event won't be added without it,
*the wp_schedule_event() function triggers the action to run immediately, even if
*set for a different time of day. */
if ( ! wp_next_scheduled( 'social_delete_posts' ) ) {
$local_time_to_run = '1am';
$timestamp = strtotime( $local_time_to_run ) + ( get_option( 'gmt_offset' ) * HOUR_IN_SECONDS );
wp_schedule_event(
$timestamp,