Support » Plugins and Hacks » Expired plugin Events Manager Extended, use Events Made Easy » EME ignores custom Content folders (WP_CONTENT_DIR, WP_CONTENT_URL)

EME ignores custom Content folders (WP_CONTENT_DIR, WP_CONTENT_URL)

  • While working on integrating EME into a site I’m working on, I checked my site’s rendered code to make sure everything was displaying properly. That’s when I noticed an error in the call to the EME stylesheet…

    <link rel='stylesheet' id='eme_stylesheet-css' href='http://www.mysite.com/content/plugins/homepages/12/x123456789/htdocs/mysite.com/www/content/plugins/events-manager-extended/events_manager.css?ver=3847' type='text/css' media='all' />

    As you can see in the path above, my WordPress content folder isn’t in the default location as I make use of WP_CONTENT_DIR and WP_CONTENT_URL in my wp-config.php file (for safety and security).

    Looking over the code, I noticed that EME doesn’t check for any use of these custom configs. To fix this up, I made the following changes in events-manager.php:

    First, around Line 114, I added a few lines to define WP_CONTENT_DIR and WP_CONTENT_URL using the default WordPress content paths, in case they haven’t been defined:

    if (!defined('WP_CONTENT_URL')) define('WP_CONTENT_URL', get_option( 'siteurl' ) . '/wp-content');
    if (!defined('WP_CONTENT_DIR')) define('WP_CONTENT_DIR', ABSPATH . 'wp-content');
    if (!defined('WP_PLUGIN_URL'))  define('WP_PLUGIN_URL', WP_CONTENT_URL. '/plugins');
    if (!defined('WP_PLUGIN_DIR'))  define('WP_PLUGIN_DIR', WP_CONTENT_DIR . '/plugins');

    Next, I had to make a couple of edits to the EME_PLUGIN_URL and EME_PLUGIN_DIR definitions, which are now around Line 121:

    define('EME_PLUGIN_URL', WP_PLUGIN_URL.'/events-manager-extended/'); //PLUGIN DIRECTORY
    define('EME_PLUGIN_DIR', WP_PLUGIN_DIR.'/events-manager-extended/'); //PLUGIN DIRECTORY

    The plugin’s name (events-manager-extended) is hard-coded, which I normally don’t like, but I just wanted to get this issue fixed before worrying about adding more.

    If you’re having this issue, this is one way to fix it. There may be alternate ways, but figured I’d get this one out there.

Viewing 3 replies - 1 through 3 (of 3 total)
  • Plugin Author Franky


    Normally the call to plugins_url() should do this for you, no need to define this all again. It might be that there’s an error in the logic used here:

    define('EME_PLUGIN_URL', plugins_url('',plugin_basename(__FILE__)).'/'); //PLUGIN DIRECTORY
    define('EME_PLUGIN_DIR', ABSPATH.PLUGINDIR.'/'.str_replace(basename( __FILE__),"",plugin_basename(__FILE__))); //PLUGIN DIRECTORY

    for the EME_PLUGIN_URL, the call to plugins_url is correct, but maybe plugin_basename() is messing things up …

    You’re absolutely right. I was troubleshooting a problem with another plugin and was having similar issues. That’s when I discovered the plugin_url function. For some reason, the web host I’m on is being really weird with certain plugins and the plugin_url function. It’s been so problematic I’m switching hosts now.

    I apologize for thinking EME was the problem.

    Plugin Author Franky


    So it works ok then for you?

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘EME ignores custom Content folders (WP_CONTENT_DIR, WP_CONTENT_URL)’ is closed to new replies.
Skip to toolbar