New Landing How can we help? Themeforest Theme Support Neighborhood Broken admin interface with custom wp-content directory

Viewing 4 posts - 1 through 4 (of 4 total)
  • #25221
    Wintermute
    Member
    Post count: 31

    For anyone who uses a non-default wp-content directory location in their WordPress installs, as is the case if you employ a similar strategy to this, then you may have noticed that the Theme Options page is a little borked. The problem lies in the Swift Framework package, more specifically, the Redux Framework that is used to handle the options admin pages. This is the case in the Neighborhood theme, though it will affect any theme that uses the Swift Framework.

    The offending code from wp-content>themes>neighborhood>includes>swift-framework>options>defaults.php (lines 5-15):

    
    $fslashed_dir = trailingslashit(str_replace('\\','/', dirname(__FILE__)));
    $fslashed_abs = trailingslashit(str_replace('\\','/', ABSPATH));
        
    if(!defined('Redux_OPTIONS_DIR')) {
         define('Redux_OPTIONS_DIR', $fslashed_dir);
    }
    
    if(!defined('Redux_OPTIONS_URL')) {
         define('Redux_OPTIONS_URL', site_url(str_replace($fslashed_abs,,fslashed_dir)));
    }

    By relying upon the ABSPATH global, the value for Redux_OPTIONS_URL gets mangled, preventing several scripts from loading correctly in the Theme Options page. Fortunately, the fix is quite easy, and does not rely upon hacking any of the theme’s core files. Simply adding the following line to the wp-config.php configuration file makes the monsters go away.

    define('Redux_OPTIONS_URL', 'http://' . $_SERVER['HTTP_HOST'] . '/wp-content/themes/neighborhood/includes/swift-framework/options/');

    You may have to modify the path to suit your particular case.

    #25245
    Wintermute
    Member
    Post count: 31

    There seems to be another instance where a custom wp-content directory breaks something in the Swift Framework.

    The code in question: wp-content/themes/neighborhood/includes/swift-framework/sf-shortcodes/config.php.php (lines 1-10):

    $wp_load = "../wp-load.php";
    $i = 0;
    
    while (!file_exists($wp_load) && $i++ < 10) {
        $wp_load = "../$wp_load";
    }
    
    require($wp_load);

    Replacing the above with the following works, though modifying the theme’s core files is not ideal.

    require_once($_SERVER['DOCUMENT_ROOT'] . '/wordpress/wp-load.php');

    I do think it would be worthwhile for the theme’s developers to handle cases where the theme and/or wordpress directories are in non-default locations, there seems to be a definite trend towards this type of install.

    #25594
    Melanie – SUPPORT
    Member
    Post count: 11032

    I’ll ask the developer to check that out,
    cheers!

    #25683
    Swift Ideas – Ed
    Keymaster
    Post count: 15264

    Thanks for letting us know, very thorough posts! We’ll check this for a future update.

    – Ed

Viewing 4 posts - 1 through 4 (of 4 total)

You must be logged in and have valid license to reply to this topic.

License required for one of the following items
Login and Registration Log in · Register