Skip to content

Instantly share code, notes, and snippets.

View alettieri's full-sized avatar
💭
thinking

Antonio Essex-Lettieri alettieri

💭
thinking
View GitHub Profile
@alettieri
alettieri / business.php
Created July 6, 2012 17:36
WordPress Geocode
function business_save_post($post_id, $post){
// verify if this is an auto save routine.
// If it is our form has not been submitted, so we dont want to do anything
if ( defined( 'DOING_AUTOSAVE' ) && DOING_AUTOSAVE )
return;
// verify this came from the our screen and with proper authorization,
// because save_post can be triggered at other times
if ( isset( $_POST[ 'business_noncename' ] ) && !wp_verify_nonce( $_POST['business_noncename'], plugin_basename( __FILE__ ) ) )
@alettieri
alettieri / business.php
Created July 6, 2012 17:49
Sortable WordPress Columns
//
// Make these columns sortable
//
function business_sortable_columns() {
return array(
'images' => 'images',
'title' => 'title',
"parking" => "parking"
);
}
@alettieri
alettieri / functions.php
Created July 11, 2012 22:46
Flush WordPress Permalinks
<?php
function flush_site_rules(){
global $wp_rewrite;
$wp_rewrite->flush_rules();
}
add_filter("wp_loaded","flush_site_rules");
@alettieri
alettieri / wp_capistrano.rb
Created August 30, 2012 17:26
WordPress Capistrano deployment file (On Webfaction)
default_run_options[:pty] = true # Must be set for the password prompt from git to work
# WebFaction user account
# This is the server user account
set :server_user, "<server_username>"
# Server Domain
set :domain, "<domain_name>"
set :user, server_user
# Repository User
@alettieri
alettieri / disable-plugins-when-doing-local-dev.php
Created August 31, 2012 22:36 — forked from markjaquith/disable-plugins-when-doing-local-dev.php
Disables specified WordPress plugins when doing local development
<?php
/*
Plugin Name: Disable plugins when doing local dev
Description: If the WP_LOCAL_DEV constant is true, disables plugins that you specify
Version: 0.1
License: GPL version 2 or any later version
Author: Mark Jaquith
Author URI: http://coveredwebservices.com/
*/
@alettieri
alettieri / google.maps.Map.offsetCenter.js
Created September 27, 2012 21:47
Offset Google Maps without Animating
/**
* Offsets the map's center from it's current position.
*
* @param {Integer} offsetX. X coord to offset by.
* @param {Integer} offsetY. Y coord to offset by.
*/
google.maps.Map.prototype.offsetCenter = function ( offsetX, offsetY ) {
// Shortcut for google Point
var gPoint = google.maps.Point,
@alettieri
alettieri / steps.txt
Created November 15, 2012 03:32
Share folders between VMware and Ubuntu Server
1. Mount the CD-ROM (Click on Add VMWare Tools first, that will add a CDROM to /dev/cdromX)
sudo mkdir /mnt/cdrom
sudo mount /dev/cdrom1 /mnt/cdrom
or
sudo mount /dev/cdrw1 /mnt/cdrom
2. Copy VMWare Tools
@alettieri
alettieri / ubunti_ip.txt
Created November 15, 2012 22:22
VMWare Ubuntu Static IP
auto eth0
iface eth0 inet static
address 192.168.198.131
netmask 255.255.255.0
network 192.168.198.0
gateway 192.168.198.2
broadcast 192.168.198.255
@alettieri
alettieri / JW_PostType.php
Created February 12, 2013 02:15
Custom Post Type helper Object.
<?php
session_start();
/**
* JW Post Types
* @author Jeffrey Way
* @link http://jeffrey-way.com
*/
class JW_Post_Type
{
@alettieri
alettieri / functions.php
Last active December 14, 2015 06:29
URL Rewriting in WordPress
<?php
/* Custom Rewrite rules for video embedding */
function flush_player_rules(){
global $wp_rewrite;
$wp_rewrite->flush_rules();
}
add_filter("wp_loaded","flush_player_rules");
function add_player_rewrite($rules){