Skip to content

Instantly share code, notes, and snippets.

View austinginder's full-sized avatar

Austin Ginder austinginder

View GitHub Profile
@austinginder
austinginder / Wordpress featured images expanded
Created November 1, 2010 13:15
Wordpress adding multiple featured images per post
@austinginder
austinginder / config.ru
Created May 2, 2012 14:18 — forked from brookr/config.ru
Rackup file I use for running WordPress on Pow
# config.ru for Pow + Wordpress, based on http://stuff-things.net/2011/05/16/legacy-development-with-pow/
# added hackery to work around Wordpress issues - Patrick Anderson (patrick@trinity-ai.com)
# added rewrite for Wordpress multisite upload directory - Austin Ginder
# clearly this could be cleaner, but it does work
require 'rack'
require 'rack-legacy'
require 'rack-rewrite'
# patch Php from rack-legacy to substitute the original request so
@austinginder
austinginder / php.ini
Created June 5, 2012 22:01
Define upload size in php.ini for Wordpress
post_max_size = 1024M
upload_max_filesize = 1024M
@austinginder
austinginder / gist:3813257
Created October 1, 2012 17:43
portion of the tp_mail.pl
# Now that we have sent the text part its time to send the attachment..
if ($MAIL{'ftype'} and $MAIL{'ahandle'})
{
print S "--$boundary1$n";
print "--$boundary1$n" if $MAIL{'debug'};
if ( $MAIL{'ftype'} =~ /^text/)
{
print S "Content-Type: $MAIL{'ftype'}; charset=us-ascii; name=\"$MAIL{'aname'}\"$n";
<?php
/*
Plugin Name: Anchor Multisite Jetpack Control
Description: Auto activate and disable select Jetpack modules
Version: 1.0
Author: austinginder
Author URI: http://austinginder.com
Network: true
License: GPL2
*/
@austinginder
austinginder / mutlisite-to-single.sql
Last active April 11, 2017 22:46
Multisite export to single install
# Delete all orphans user meta in WordPress
DELETE FROM wp_usermeta
WHERE NOT EXISTS (
SELECT * FROM wp_users
WHERE wp_usermeta.user_id = wp_users.ID
);
# Remove multisite only columns in users
alter table wp_users drop column spam;
alter table wp_users drop column deleted;
# Adds new account
INSERT INTO `wp_users` (`ID`, `user_login`, `user_pass`, `user_nicename`, `user_email`, `user_url`, `user_registered`, `user_activation_key`, `user_status`, `display_name`) VALUES
(null, 'firstlastname', 'known-password-hash', 'First Last Name', 'email@example.com', '', NOW(), '', 0, 'First Last Name');
# Selects autogenerated ID
SET @autogenerated_id = LAST_INSERT_ID();
# Setups new account as a WordPress admin
INSERT INTO `wp_usermeta` (`umeta_id`, `user_id`, `meta_key`, `meta_value`) VALUES
(null, @autogenerated_id, 'wp_capabilities', 'a:1:{s:13:"administrator";b:1;}'),
<?php
### PHP command line wrapper for WP Engine's web based WP-CLI
### Example command line: php wp_engine_cli.php -i wp_install_name -c "cli info"
# Grab options from command line
$options = getopt("i:c:");
# Break out into variables
$install = $options["i"];
@austinginder
austinginder / protected.php
Last active January 29, 2020 16:59 — forked from hakre/dl-file.php
Wordpress login to download uploaded files
<?php
/*
* protected.php
*
* Protect uploaded files with login.
*
* @link http://wordpress.stackexchange.com/questions/37144/protect-wordpress-uploads-if-user-is-not-logged-in
*
* @author hakre <http://hakre.wordpress.com/>
* @license GPL-3.0+