Skip to content

Instantly share code, notes, and snippets.

View jonbish's full-sized avatar

Jon Bishop jonbish

View GitHub Profile
@jonbish
jonbish / Filter Inspector
Created May 15, 2012 15:22
Find All Functions Hooking Into A Filter/Action in WordPress
<?php
/*
Plugin Name: Find Functions Hooking Into Filters/Actions
Description: Find All Functions Hooking Into A Filter/Action in WordPress
Author: Jon Bishop
Author URI: http://www.jonbishop.com/
Version: 1.0
*/
function amp_find_filters($filter_name) {
@jonbish
jonbish / gist-sidebar-widget
Created May 24, 2012 03:48 — forked from norcross/gist-sidebar-widget
Public Gist Sidebar Widget
<?php
/*
Plugin Name: GitHub Gists Sidebar Widget
Plugin URI: http://andrewnorcross.com/plugins
Description: A sidebar widget to display your public gists from GitHub.
Version: 1.0
Author: norcross
Author URI: http://andrewnorcross.com
*/
/* Copyright 2012 Andrew Norcross
@jonbish
jonbish / test-head-footer.php
Created June 16, 2012 20:08 — forked from sivel/test-head-footer.php
WordPress Plugin to test for the existence and functionality of wp_head and wp_footer in the active theme
@jonbish
jonbish / get-social-counts.php
Created June 19, 2012 15:44 — forked from kopiro/get-social-counts.php
Get social counts from Facebook, Twitter, GPlus
<?php
/* Return object of shared counts */
function get_social_count( $link ) {
$r = (object)array();
$r->facebook = get_social_count_facebook($link);
$r->twitter = get_social_count_twitter($link);
$r->gplus = get_social_count_gplus($link);
return $r;
}
@jonbish
jonbish / Trash Redirect WordPress Plugin
Created October 22, 2012 17:18
301 Redirect trashed posts to the home page instead of a 404 page
<?php
/*
Plugin Name: Trash Redirect
Description: 301 Redirect trashed posts to the home page instead of a 404 page
*/
add_action('template_redirect', 'trash_redirect');
function trash_redirect(){
if (is_404()){
global $wp_query, $wpdb;
<?php
// Modified from http://wordpress.stackexchange.com/a/5404
function my_search_where($where){
global $wpdb;
if (isset($_GET['all-search']))
$where .= " AND (t.name LIKE '%".like_escape($_GET['all-search'] )."%' OR post_title LIKE '%".like_escape($_GET['all-search'] )."%' OR post_content LIKE '%".like_escape($_GET['all-search'] )."%' OR $wpdb->postmeta.meta_value LIKE '%".like_escape($_GET['all-search'] )."%')";
return $where;
}
function my_search_join($join){
<?php
stdClass Object
(
[term_id] => 286
[name] => Experiential
[slug] => experiential
[term_group] => 0
[term_taxonomy_id] => 1290
[taxonomy] => services
[description] =>
<?php
WP_Post Object
(
[ID] => 7677
[post_author] => 1
[post_date] => 2013-08-08 15:17:45
[post_date_gmt] => 2013-08-08 15:17:45
[post_content] => This is the content
[post_title] => This Is The Title
[post_excerpt] =>
@jonbish
jonbish / gist:d23119bb45ae09b83570
Created May 29, 2014 17:29
Custom WP Author Social
add_filter('wp_about_author_get_socials', 'my_custom_socials');
function my_custom_socials($socials){
$socials['twitter'] = array('title'=>'Twitter', 'link'=>'%%username%%', 'icon'=> WPAUTHORURL_URL .'/images/twitter.png');
$socials['facebook'] = array('title'=>'Facebook', 'link'=>'%%username%%', 'icon'=> WPAUTHORURL_URL .'/images/facebook.png');
$socials['linkedin'] = array('title'=>'LinkedIn', 'link'=>'%%username%%', 'icon'=> WPAUTHORURL_URL .'/images/linkedin.png');
$socials['pinterest'] = array('title'=>'Pinterest', 'link'=>'%%username%%', 'icon'=> WPAUTHORURL_URL .'/images/pinterest.png');
$socials['googleplus'] = array('title'=>'Google Plus', 'link'=>'%%username%%', 'icon'=> WPAUTHORURL_URL .'/images/googleplus.png');
$socials['digg'] = array('title'=>'Digg', 'link'=>'%%username%%', 'icon'=> WPAUTHORURL_URL .'/images/digg.png');
$socials['flickr'] = array('title'=>'Flickr', 'link'=>'%%username%%', 'icon'=> WPAUTHORURL_URL .'/images/flickr.png');
$socials['stumbleupon'] =
<link rel="import" href="../core-icon-button/core-icon-button.html">
<link rel="import" href="../core-toolbar/core-toolbar.html">
<link rel="import" href="../core-header-panel/core-header-panel.html">
<link rel="import" href="../speech-mic/speech-mic.html">
<link rel="import" href="../google-map/google-map-search.html">
<link rel="import" href="../core-icons/core-icons.html">
<link rel="import" href="../paper-item/paper-item.html">
<link rel="import" href="../paper-toast/paper-toast.html">
<link rel="import" href="../cool-clock/cool-clock.html">
<link rel="import" href="../yt-video/yt-search-video.html">