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 / gist:293ff7c81c453d505647
Created March 12, 2015 21:02
Delete all post revisions and their metadata
DELETE a,b,c FROM wp_posts a WHERE a.post_type = 'revision' LEFT JOIN wp_term_relationships b ON (a.ID = b.object_id) LEFT JOIN wp_postmeta c ON (a.ID = c.post_id);
DELETE FROM wp_links WHERE link_url = 'http://codex.wordpress.org/';
DELETE FROM wp_links WHERE link_url = 'http://wordpress.org/news/';
DELETE FROM wp_links WHERE link_url = 'http://wordpress.org/support/';
DELETE FROM wp_links WHERE link_url = 'http://wordpress.org/extend/plugins/';
DELETE FROM wp_links WHERE link_url = 'http://wordpress.org/extend/themes/';
DELETE FROM wp_links WHERE link_url = 'http://wordpress.org/support/forum/requests-and-feedback';
DELETE FROM wp_links WHERE link_url = 'http://planet.wordpress.org/';
  • This is a complete item
  • This is an incomplete item
@bhubbard
bhubbard / jetpack_prefetch_hook.php
Last active October 22, 2015 23:14
Hook into Jetpack for DNS Prefetch
if (class_exists('Jetpack')) {
Jetpack::dns_prefetch( array(
'//example.com',
) );
}
@bhubbard
bhubbard / gist:4cba24fb70a8e1f7199c
Created March 25, 2015 17:59
WP Lawyer Taxonomies
<?php
// Practice Areas
$terms = get_the_terms( $post->ID, 'wplawyer-practice-area' );
foreach($terms as $term) {
echo $term->name;
}
?>
<?php
<h3>Attornys who practice Burn Injuries</h3>
<?php
$args = array(
'tax_query' => array(
array(
'taxonomy' => 'wplawyer-practice-area',
'field' => 'slug',
'terms' => array( 'burn-injury' )
),
),
@bhubbard
bhubbard / gist:b29fb4e103034ee7a3b5
Created March 26, 2015 17:40
Example URL with all Taxonomies in URL
/listings/?property-types=PROPERTYTYPENAME&property-status=STATUSNAME&locations=LOCATIONNAME&features=FEATURENAME
@bhubbard
bhubbard / view-all-shortcodes.php
Created March 27, 2015 18:58
All available shortcodes
<?php
/*
Plugin Name: Paulund View All Shortcodes
Plugin URI: http://www.paulund.co.uk
Description: View all the available shortcodes on your WordPress blog. This page will show you everything that is currently registered so you can use these in the text editor of WordPress
Version: 1
Author: Paul Underwood
Author URI: http://www.paulund.co.uk
http://www.paulund.co.uk/get-list-of-all-available-shortcodes
<?php
################################################################################
// Featured Image for RSS FEEDS
################################################################################
function clientname_post_thumbnail_rss($content) {
global $post;
if ( has_post_thumbnail( $post->ID ) ){
$content = '' . get_the_post_thumbnail( $post->ID, 'rss-image', array( 'style' => 'float:left; margin-right:10px; height: 150px; width: 300px; border: 2px solid #e5e5e5' ) ) . '' . $content;
}
return $content;
<?php
/*
*
* Template Name: IDX Broker
*
* This template is for displaying the IDX info from
* IDXBroker.com in your Genesis child theme.
*/
add_action( 'genesis_before_content', 'wsm_idx_open_tag' );