OpenShift WordPress - 如何正确定义WP_CONTENT_DIR和WP_CONTENT_URL以修复某些主题中破碎的主题选项?

时间:2016-01-13 16:52:36

标签: php wordpress openshift

主题选项面板无法在OpenShift上正确加载某些主题。

根据theme developer,这是因为主题

  

使用redux选项框架构建。 redux的开发者   使用WP_CONTENT_DIR和WP_CONTENT_URL定义的两个核心常量   WordPress的。如果它们没有正确定义那么主题选项   没有正确加载。

我试图在wp-config.php中正确定义它们但没有成功。我的更改导致网站返回空白页面或没有CSS。我知道将它们放在wp-config中很重要,也许这是问题的一部分。 例如,添加前两行:

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');

以下各种变体:

      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' );

我也试过定义这些例子的路径:

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

如果有人能指出我正确的方向,我将非常感激。 提前谢谢。

0 个答案:

没有答案