/** * Returns the non-CDN'd URI to the specified path. * * @param string $path Must be a full path, e.g. dirname( __FILE__ ) * @return string */ function wpcom_vip_noncdn_uri($path) { // Be gentle on Windows, borrowed from core, see plugin_basename $path = str_replace('\\', '/', $path); // sanitize for Win32 installs $path = preg_replace('|/+|', '/', $path); // remove any duplicate slash return sprintf('%s%s', wpcom_vip_themes_root_uri(), str_replace(wpcom_vip_themes_root(), '', $path)); }
<?php fieldmanager_set_baseurl(wpcom_vip_themes_root_uri() . '/plugins/fieldmanager/'); /** * Patch for get_user_attribute to work with Field Manager. * @param integer $user_id User ID. * @param string $key Optional key. * @param boolean $single True to return single value. * * @see get_user_meta() * * @return mixed */ function wpcom_fieldmanager_get_user_attribute($user_id, $key, $single) { $user_data = get_user_attribute($user_id, $key); if (!$single) { $user_data = array($user_data); } return $user_data; } // Replace user meta functions with user attributes. add_filter('fm_user_context_get_data', function () { return 'wpcom_fieldmanager_get_user_attribute'; }); add_filter('fm_user_context_add_data', function () { return 'add_user_attribute'; }); add_filter('fm_user_context_update_data', function () { return 'update_user_attribute'; });
<?php add_filter('mce_external_plugins', function ($plugins) { if (isset($plugins['table'])) { $plugins['table'] = wpcom_vip_themes_root_uri() . '/plugins/mce-table-buttons/tinymce4-table/plugin.min.js'; } // hack around cross-domain issues because plugins_url is passed through our CDN return $plugins; }, 99); // run later so we override the plugin