Skip to content

Instantly share code, notes, and snippets.

@kirkegaard
kirkegaard / install_wordpress.sh
Created March 16, 2010 10:44
install wordpress from a selected source
#!/bin/bash
CURRENT_PATH=`pwd`
INSTALL_FOLDER="public_html"
METHOD="HTTP"
HTTP_SOURCE="http://wordpress.org/latest.tar.gz"
SVN_SOURCE=""
SVN_SOURCE_BASE="http://core.svn.wordpress.org"
SVN_SOURCE_STABLE="/tags/2.9.2/"
SVN_SOURCE_TRUNK="/trunk/"
@doolin
doolin / svn_overwrite.sh
Created June 15, 2011 15:19
svn overwriting a WordPress installation
#!/usr/bin/sh
# This script will overwrite an existing
# WordPress installation with the current
# head of trunk. Once it has been reverted,
# you may need to update the database, and
# WP will prompt you for that automatically.
# This is untested with these options!
# The script commands work from the command
@scribu
scribu / cpt-redirect.php
Created July 27, 2011 22:49
CPT Redirect
<?php
define( 'MY_CPT', 'actor' );
/**
* Redirects /cary-grant/ to /actor/cary-grant/ or whatever the correct URL is
*/
function redirect_old_cpt_urls() {
if ( !is_404() )
return;
@markjaquith
markjaquith / README.md
Created August 16, 2011 19:33
TLC Transients — On the fly WordPress transients with soft expiration and one-liner chained syntax.
@ammist
ammist / change_urls.sql
Created August 31, 2011 07:28
MySQL Wrangling
-- handy for moving a database from prouction to your local environment.
-- change URL's in wordpress single-site install. Replace with your own URL's.
-- this doesn't address serialized options.
UPDATE wp_options SET option_value = "http://localhost:8888" WHERE option_name = "home";
UPDATE wp_options SET option_value = "http://localhost:8888" WHERE option_name = "siteurl";
update wp_postmeta set meta_value = replace(meta_value, 'http://example.com', 'http://localhost:8888') where meta_key='_menu_item_url';
update wp_posts set post_content = replace(post_content, 'http://example.com', 'http://localhost:8888');
@mikeschinkel
mikeschinkel / parks-and-features.php
Created November 5, 2011 23:16
Plugin demonstrates how to route parent post/child post URLs WordPress 3.3
<?php
/**
* Plugin Name: MMC Parks and Features
* Description: This plugin demonstrates how to route parent/child URLs like http://example.com/parks/yosemite/half-dome/in WordPress 3.3
* Author: Mike Schinkel
* Author URL: http://about.me/mikeschinkel
* Notes:
* To answer http://lists.automattic.com/pipermail/wp-hackers/2011-November/041486.html
* Assumes a metabox that sets $post->post_parent field for a park feature with it's park's $post->ID.
*
@rmccue
rmccue / plugin-file.php
Created January 17, 2012 12:27 — forked from kovshenin/plugin-file.php
Improved class concept
<?php
/*****
All new versions will be posted at
https://github.com/rmccue/Rotor_WPPlugin
Please use that repository instead of this Gist.
******/
@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"
);
}
@nacin
nacin / func.sh
Created July 10, 2012 16:44
Nacin's WP Test Wrapper
function wptest() {
TESTROOT=/Users/nacin/Sites/tests
ARGS="--colors $@"
FORCE=0
DEBUG=0
REPLACE=$(echo $ARGS | sed -e 's/ -f\>//')
if [ "$ARGS" != "$REPLACE" ]; then
FORCE=1
ARGS=$REPLACE