Skip to content

Instantly share code, notes, and snippets.

View benbalter's full-sized avatar
Verified

Ben Balter benbalter

Verified
View GitHub Profile
@benbalter
benbalter / ga-jetpack-social.php
Last active September 26, 2015 07:07
Google Analytics Tracking of JetPack (Sharedaddy) Social Engagement
<?php
/**
* Plugin Name: Jetpack (Sharedaddy) Google Analytics Tracking
* Description: Allows tracking of Facebook and Twitter shares in Google Analytics Social Tracking
* Author: Benjamin J. Balter
* Author URI: http://ben.balter.com
* Version: 0.1
*/
/**
@benbalter
benbalter / remove-sexybookmarks.php
Created October 18, 2011 12:36
Remove SexyBookmarks from WP Resume pages
function remove_shrsb () {
remove_filter('the_content', 'shrsb_position_menu');
}
function wpr_add_shrsb() {
add_filter('the_content', 'shrsb_position_menu');
}
add_action( 'wp_resume_shortcode_pre', 'wpr_remove_shrsb' );
add_action( 'wp_resume_shortcode_post', 'wpr_add_shrsb' );
@benbalter
benbalter / enable-sb-metabox.php
Created October 18, 2011 12:43
Enable SexyBookmarks metabox on resume positions
function wpr_add_sb_metabox() {
if( !function_exists( 'shrsb_get_current_user_role' ) ||
( shrsb_get_current_user_role() != "Administrator" && shrsb_get_current_user_role() != "Editor")
)
return false;
add_meta_box( 'hide_options_meta', __( 'Shareaholic', 'shrsb' ), '_hide_options_meta_box_content', 'wp_resume_position', 'advanced', 'high' );
}
@benbalter
benbalter / top-help-users.php
Created December 28, 2011 18:10
Top Help Users Widget
<?php
/*
Plugin Name: Top Help Users
Description: Widget to display top users of help.hackshackers.com by reputation
Author: Benjamin J. Balter
Version: 1.0
Author URI: http://ben.balter.com
*/
class Top_Help_Users_Widget extends WP_Widget {
@benbalter
benbalter / recent-answers-widget.php
Created January 5, 2012 18:13
Recently Answered Questions
<?php
/*
Plugin Name: Help - Recently Answered Questions
Description: Widget to display recently answers questions on help.hackshackers.com
Author: Benjamin J. Balter
Version: 1.0
Author URI: http://ben.balter.com
*/
class Recent_Answers_Widget extends WP_Widget {
@benbalter
benbalter / display-custom-fields.php
Created January 15, 2012 16:03
Display Custom Fields
function content_filter( $content ) {
global $post;
$output = array();
$taxs = get_taxonomies( array( 'object_type' => array( $post->post_type ) ) );
foreach ( $taxs as $tax ) {
$tax = get_taxonomy( $tax );
$terms = get_the_term_list( $post->ID, $tax->name, null, ', ' );
@benbalter
benbalter / faceted-search-page-title.php
Created January 17, 2012 16:14
Faceted Search Page Title
<?php
/**
* Replaces default template title with faceted search "breadcrumbs" describing the instant query
* @author Benjamin J. Balter
* @package Faceted_Search_Widget
*/
//function to be placed in theme's functions.php file...
function faceted_search_page_title( ) {
@benbalter
benbalter / svn.txt
Created January 20, 2012 15:58
git/svn Cheatsheet
# ADD ALL FILES (Recursively):
svn add --force *
# Remove deleted files:
svn status | grep '^\!' | cut -c8- | while read f; do svn rm "$f"; done
# HTTPS workaround:
@benbalter
benbalter / instructions.md
Last active September 30, 2015 00:48
View without cache bookmarklet
@benbalter
benbalter / siege-gen.php
Created March 21, 2012 20:49
Random URL generator for Siege URL files
<PRE>
<?php
/**
* Generates list of random URLs for use with Siege
* Usefull for getting around caching and whatnot
*/
//path to a wp-load file
include( 'trunk/wp-load.php' );