Skip to content

Instantly share code, notes, and snippets.

View mojowill's full-sized avatar
:octocat:

Will Wilson mojowill

:octocat:
View GitHub Profile
@mojowill
mojowill / gist:1201002
Created September 7, 2011 16:15 — forked from joeytrapp/gist:1201000
Global ignore file
# Numerous always-ignore extensions
*.diff
*.err
*.orig
*.log
*.rej
*.swo
*.swp
*.vi
*~
@mojowill
mojowill / gist:1260045
Created October 3, 2011 19:50
Get Rid of stupid extra 10px on Wordpress Image captions!
//Remove Stupid 10xp from around the Caption Images
class fixImageMargins{
public $xs = 0; //change this to change the amount of extra spacing
public function __construct(){
add_filter('img_caption_shortcode', array(&$this, 'fixme'), 10, 3);
}
public function fixme($x=null, $attr, $content){
extract(shortcode_atts(array(
@mojowill
mojowill / gist:1370492
Created November 16, 2011 16:09
Final Related Custom Items
<?php
function vt_related($taxonomy = null, $post_type = null) {
global $post;
// Set the default taxonomy
if (!$taxonomy) {
$taxonomy = 'service_tag';
}
/**
* jQuery Pong plugin
*
* @name jquery-pong-0.4.1.js
* @author Geoffray Warnants - http://www.geoffray.be
* @version 0.4.1
* @date 20100127
* @example http://www.geoffray.be/lab/pong
*
* @todo Better reflect the default options (+ initialisaiton via CSS)
@mojowill
mojowill / users.php
Created August 14, 2012 09:54
User Select for Rilwis Custom Meta Boxes
<?php
$users_list = array();
$users = get_users();
if ( !empty( $users ) )
$users_list = array_combine( wp_list_pluck( $users, 'ID' ), wp_list_pluck( $users, 'display_name' ) );
$meta_box = array(
'title' => 'Project Information',
'pages' => array( 'project' ),
@mojowill
mojowill / gist:3619544
Created September 4, 2012 10:14 — forked from joeytrapp/gist:1201000
Global ignore file
# Numerous always-ignore extensions
*.diff
*.err
*.orig
*.log
*.rej
*.swo
*.swp
*.vi
*~
@mojowill
mojowill / dl-file.php
Last active February 1, 2018 14:07
Secure your gravity forms uploads
<?php
require_once('wp-load.php');
is_user_logged_in() || auth_redirect();
$upload_dir = wp_upload_dir();
//Set your path below I am using /gravity_forms/
$basedir = $upload_dir[ 'basedir' ] . '/gravity_forms/';
$file = rtrim( $basedir, '/' ) . '/' . str_replace( '..', '', isset( $_GET[ 'file' ] ) ? $_GET[ 'file' ] : '' );
if ( ! $basedir || ! is_file( $file ) ) {
@mojowill
mojowill / Monokai Bright WordPress.thTheme
Created January 4, 2013 10:16
Modification of the Monokai Bright Theme for SublimeText 2 to support and highlight WordPress function calls.
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>name</key>
<string>Monokai Bright WordPress</string>
<key>settings</key>
<array>
<dict>
<key>settings</key>
@mojowill
mojowill / avatar.php
Last active May 30, 2017 15:07
Custom WordPress Default Avatar
<?php
function custom_gravatar ( $avatar_defaults ) {
$mytavatar = get_theme_directory_uri . '/images/avatar.jpg'; // Make Sure you change this depending on your image name and location
$avatar_defaults[ $mytavatar ] = 'My Custom Gravatar'; // This is what is displayed in the Admin settings when Picking your Default Avatar
return $avatar_defaults;
}
add_filter( 'avatar_defaults', 'custom_gravatar' );
@mojowill
mojowill / margins.php
Created June 11, 2017 16:25
Fix WordPress margins
<?php
//Remove Stupid 10xp from around the Caption Images
class fixImageMargins{
public $xs = 0; //change this to change the amount of extra spacing
public function __construct(){
add_filter('img_caption_shortcode', array(&$this, 'fixme'), 10, 3);
}
public function fixme($x=null, $attr, $content){