Skip to content

Instantly share code, notes, and snippets.

View polevaultweb's full-sized avatar

Iain Poulson polevaultweb

View GitHub Profile
@polevaultweb
polevaultweb / htaccess_image_sync
Last active August 29, 2015 14:03
WordPress .htaccess images
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /wp-content/uploads/
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*) http://livesite.com/wp-content/uploads/$1 [L,P]
</IfModule>
@polevaultweb
polevaultweb / site_functions.php
Last active August 29, 2015 14:06
This is a plugin that allows you to tweak the functionality of Instagrate Pro plugin. Add it to your wp-content/plugins folder and activate as you would a normal plugin
<?php
/*
Plugin Name: Site Functions
Description: Functionality changes to WordPress, plugins, and themes instead of using functions.php.
Version: 0.1
License: GPL
Author: Your Name
Author URI: yoururl
*/
@polevaultweb
polevaultweb / wpmdb_profile_id_edits.php
Last active August 29, 2015 14:14
Edit profile IDs for WP Migrate DB Pro
<?php
add_action( 'admin_init', 'wpmdb_tweak_profile_id_edit' );
function wpmdb_tweak_profile_id_edit() {
$profile_mappings = array(
2 => 1,
3 => 2,
);
$wpmdb_settings = get_site_option( 'wpmdb_settings' );
@polevaultweb
polevaultweb / bulk_blogs.sh
Last active August 29, 2015 14:23
Create bulk amount of blogs in a WordPress Multisite
#!/usr/bin/env bash
cd /Applications/MAMP/htdocs/dbtestingmssd/
for i in {1..150}
do
wp site create --slug="test$i"
done
@polevaultweb
polevaultweb / custom_as3cf_upload.php
Last active August 31, 2015 16:55
Custom image upload to Amazon S3
add_action('admin_init', 'base_file');
function base_file() {
$parent_post_id = 0;
$upload_dir = wp_upload_dir();
// @new
$upload_path = str_replace( '/', DIRECTORY_SEPARATOR, $upload_dir['path'] ) . DIRECTORY_SEPARATOR;
<?php
/**
* Class API
*/
class API extends \WP_UnitTestCase {
/**
* @var \DeliciousBrains\Offload\AWS\API
*/
add_filter( 'igp_template_caption_no_tags', 'my_igp_template_caption_no_tags' );
function my_igp_template_caption_no_tags( $caption ) {
$caption_parts = explode( '&&', $caption );
return $caption[0];
}
add_filter( 'igp_template_caption', 'my_igp_template_caption' );
@polevaultweb
polevaultweb / wpos3-oembed-library.php
Last active February 19, 2016 14:46
oEmbed Library Addon for WP Offload S3
<?php
/*
Plugin Name: WP Offload S3 - oEmbed Library Addon
*/
/**
* OEmbed in Library
* https://wordpress.org/plugins/oembed-in-library/
*/
function wpos3_oembed_lib_init() {
@polevaultweb
polevaultweb / nf_fu_dir_tweak.php
Last active April 2, 2016 09:30
WordPress Plugin to change Ninja Forms File Upload directory
<?php
/**
* Plugin Name: Ninja Forms File Uploads Directory Tweak
* Plugin URI: http://polevaultweb.com
* Description: Tweaks plugin
* Version: 1.0
* Author: polevaultweb
* Author URI: http://polevaultweb.com
*/
@polevaultweb
polevaultweb / igp_image_filename.php
Last active April 11, 2016 10:16
Using the `igp_image_filename` filter in Instagrate Pro
<?php
add_filter( 'igp_image_filename', 'my_igp_image_filename', 10, 4 );
function my_igp_image_filename( $file_name, $file, $post_name, $postid ) {
$file_name_parts = explode( '.', $file_name );
$ext = array_pop( $file_name_parts );
$file_name = 'my-prefix-' . implode( '.', $file_name_parts ) . '-'. date( 'Y-m-d' ) . '.' . $ext;
return $file_name;