Created
April 7, 2021 17:57
-
-
Save invisnet/b533f12c59f61682fa5a0db9155e1dbe to your computer and use it in GitHub Desktop.
Shared mu-plugins Freemius Path Fixer
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: Shared mu-plugins Freemius Path Fixer | |
* Plugin URI: https://gist.github.com/invisnet/b533f12c59f61682fa5a0db9155e1dbe | |
* Description: Fix the Freemius WordPress SDK asset paths when hosting with shared mu-plugins directory. | |
* Version: 0.9.0 | |
* Author: Charles Lecklider | |
* Author URI: https://invis.net/ | |
* License: GPLv2 | |
*/ | |
/** | |
* Override the Freemius functions in `fs-core-functions.php` | |
*/ | |
function fs_enqueue_local_style($handle, $path, $deps = array(), $ver = false, $media = 'all') | |
{ | |
wp_enqueue_style($handle, '/wp-content/mu-plugins/wordpress-sdk/assets/css/'.trim($path, '/'), $deps, $ver, $media); | |
} | |
function fs_enqueue_local_script($handle, $path, $deps = array(), $ver = false, $in_footer = 'all') | |
{ | |
wp_enqueue_script($handle, '/wp-content/mu-plugins/wordpress-sdk/assets/js/'.trim($path, '/'), $deps, $ver, $in_footer); | |
} | |
function fs_img_url($path, $img_dir = WP_FS__DIR_IMG) | |
{ | |
return '/wp-content/mu-plugins/wordpress-sdk/assets/img/'.trim($path, '/'); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment