Skip to content

Instantly share code, notes, and snippets.

View barryroodt's full-sized avatar

Barry Roodt barryroodt

View GitHub Profile

Keybase proof

I hereby claim:

  • I am barryroodt on github.
  • I am barryroodt (https://keybase.io/barryroodt) on keybase.
  • I have a public key ASCEsw9HBUfOZPGqVULDeDbueORy5JuOVSQg99a8k3vtBwo

To claim this, I am signing this object:

@barryroodt
barryroodt / gist:3551287
Created August 31, 2012 10:34
Move WordPress easily
Be sure to leave out trailing slashes
UPDATE wp_options SET option_value = replace(option_value, 'http://oldURL', 'http://yourUrl');
UPDATE wp_posts SET guid = replace(guid, 'http://oldURL', 'http://yourUrl');
UPDATE wp_posts SET post_content = replace(post_content, 'http://oldURL', 'http://yourUrl');
UPDATE wp_postmeta SET meta_value = replace(meta_value, 'http://oldURL', 'http://yourUrl');
@barryroodt
barryroodt / gist:3424850
Created August 22, 2012 12:00
Function to auto-resize images already uploaded to WordPress.
/*
Place inside your functions.php
Example usage inside template: echo jt_get_image(get_the_ID(), 'my-image-size');
*/
function jt_get_image($post_id, $size='post-thumbnail')
{
global $_wp_additional_image_sizes;
$thumb = get_post_meta($post_id, "_thumbnail_id", true);
$fullsizepath = get_attached_file( $thumb );