Created
August 21, 2010 11:18
-
-
Save timwhitlock/542166 to your computer and use it in GitHub Desktop.
Simple tools for deploying Wordpress assets on a CDN
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
Plugin Name: CDN Tools | |
Plugin URI: http://web.2point1.com/tag/wp-cdn | |
Description: Simple tool for deploying Wordpress assets on a CDN | |
Version: 0 | |
Author: Tim Whitlock | |
Author URI: http://twitter.com/timwhitlock | |
*/ | |
/** | |
* Gets the base URL for all themes on CDN | |
*/ | |
function wp_cdn_theme_root_uri( $themes_baseurl, $site_baseurl, $theme_dir ){ | |
if( strpos( $themes_baseurl, WP_CDN_ROOT ) === false ){ | |
$path = str_replace( $site_baseurl, '', $themes_baseurl ); | |
$themes_baseurl = WP_CDN_ROOT . $path; | |
} | |
return $themes_baseurl; | |
} | |
// add filters | |
if( defined('WP_CDN_ROOT') ){ | |
add_filter('theme_root_uri', 'wp_cdn_theme_root_uri', 0, 3 ); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment