OpenShift WordPress – How to define WP_CONTENT_DIR and WP_CONTENT_URL correctly to fix broken theme options in some themes?

The theme options panel does not load correctly with certain themes on OpenShift.

According to the theme developer this is because the theme

Read More

is built using the redux options framework. The developers of redux
use WP_CONTENT_DIR and WP_CONTENT_URL two core constants defined by
WordPress. If they are not correctly defined then the theme options
don’t load correctly.

I have tried to define them correctly in wp-config.php without success. My changes have resulted in the website returning a blank page or without CSS. I understand it is important where I place them in wp-config, perhaps this is part of the problem.
For example, adding the first two lines:

define( 'WP_CONTENT_DIR', dirname( __FILE__ ) . 'OPENSHIFT_DATA_DIR/current/wp-content' );
define( 'WP_CONTENT_URL', 'http://' . $_SERVER['HTTP_HOST'] . '/OPENSHIFT_DATA_DIR/current/wp-content' );

// absolute path to the WordPress directory
if ( !defined('ABSPATH') )
  define('ABSPATH', dirname(__FILE__) . '/');

// tell WordPress where the plugins directory really is
if ( !defined('WP_PLUGIN_DIR') && is_link(ABSPATH . '/wp-content/plugins') )
  define('WP_PLUGIN_DIR', realpath(ABSPATH . '/wp-content/plugins'));

// sets up WordPress vars and included files
require_once(ABSPATH . 'wp-settings.php');

And variations of the following:

define ('WP_CONTENT_DIR','/full/path/to/your/content/dir');
define ('WP_CONTENT_URL','http://example.com/full/path/to/your/content/dirs/url');

define( 'WP_CONTENT_DIR', dirname(__FILE__) . '/wp-content' );
define( 'WP_CONTENT_URL', 'http://example.com/wp-content' );

define(‘WP_CONTENT_DIR’, $_SERVER['DOCUMENT_ROOT'] . ‘/wp-content’);
define(‘WP_CONTENT_URL’, ‘http://example.com/wp-content’);

define( 'WP_CONTENT_DIR', dirname( __FILE__ ) . 'path/to/wp-content' );
define( 'WP_CONTENT_URL', 'http://' . $_SERVER['HTTP_HOST'] . '/path/to/wp-content' );

I have also tried defining the path simmilar to these examples:

/var/lib/openshift/12345678901234567890123456/app-root/data
OPENSHIFT_DATA_DIR/current/wp-content

If anyone could point me in the right direction I will be most grateful.
Thanks in advance.

Related posts