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
/**
* Disable WPSEO Nag on Dev Server
*
*/
function be_disable_wpseo_nag( $options ) {
if( strpos( site_url(), 'localhost' ) || strpos( site_url() ,'master-wp' ) )
$options['ignore_blog_public_warning'] = 'ignore';
return $options;
}
add_filter( 'option_wpseo', 'be_disable_wpseo_nag' );
add_action("wpcf7_before_send_mail", "wpcf7_do_something_else");
function wpcf7_do_something_else(&$wpcf7_data) {
// Here is the variable where the data are stored!
var_dump($wpcf7_data);
// If you want to skip mailing the data, you can do it...
$wpcf7_data->skip_mail = true;
add_action("gform_after_submission", "set_post_content", 10, 2);
function set_post_content($entry, $form){
//Gravity Forms has validated the data
//Our Custom Form Submitted via PHP will go here
// Lets get the IDs of the relevant fields and prepare an email message
$message = print_r($entry, true);
// In case any of our lines are larger than 70 characters, we should use wordwrap()
$message = wordwrap($message, 70);
@bhubbard
bhubbard / yoast-localseo-titles.markdown
Last active December 30, 2015 01:59
Here is my template for the global titles and descriptions in yoast. Quick Useful Link: http://www.quicksprout.com/the-advanced-guide-to-seo-chapter-4/

These are the default titles & descriptions I use when using the Local SEO plugin. Note this is only available and used when doing multiple locations.

#####Yoast Local SEO CPT (Default CPT Name is Locations)

Title: %%title%% %%sep%% %%cf__wpseo_business_address%% %%cf__wpseo_business_city%%, %%cf__wpseo_business_state%% %%cf__wpseo_business_zipcode%% %%cf__wpseo_business_country%% %%sep%% %%pt_single%% %%sep%% %%sitename%%

Description: %%excerpt%%

#####Yoast Local SEO CPT Archive Page (Default CPT Name is Locations)

#!/bin/bash
# cd into the directory
cd ~/gitsync/github-wordpress-sync/;
# Make sure we are not already running
if [ -f .sync-running ];then
if test ! `find ".sync-running" -mmin +10`;then
# Currently running, but not stuck
exit 1;
fi
fi;
.gform_wrapper ul {
.list-unstyled();
}
.gform_wrapper li {
.form-group();
}
.gform_wrapper form {
margin-bottom: 0;
}
.gform_wrapper .gfield_label {
function vhost {
sudo ~/.dotfiles/osx/mamp_vh.sh $1
}
@bhubbard
bhubbard / wp-config-local-sample.php
Last active October 26, 2023 02:50
This is my Template for a wp-config file.
<?php
################################################################################
// Custom WordPress Local Config
// Use only for Development
// https://gist.github.com/bhubbard/8428583
################################################################################
/* Database Connection Info */
define('DB_NAME', '');
define('DB_USER', '');
@bhubbard
bhubbard / run-all.sql
Last active March 13, 2018 19:23
These are various SQL Queries to run to update urls within a WordPress Database. These queries assume the table prefix is the standard `wp_`, if you have a custom prefix you will need to update the queries. I also recommend changing the default urls using this method: https://codex.wordpress.org/Changing_The_Site_URL or http://codex.wordpress.or…
/* Set our Old and New URLS */
SET @oldurl := "http://www.oldsite.com";
SET @newurl := "http://www.newsite.com";
/* Replaces URL in WordPress Home and Site URL in wp_options */
UPDATE wp_options SET option_value = replace(option_value, @oldurl, @newurl) WHERE option_name = 'home' OR option_name = 'siteurl';
/* Replaces URL in GUID of all posts/cpt/etc */
/* https://deliciousbrains.com/wordpress-post-guids-sometimes-update/ */
UPDATE wp_posts SET guid = replace(guid, @oldurl, @newurl);