插件路径的主题路径

时间:2017-10-09 07:41:00

标签: php wordpress


"dependencies": {
    "material-ui": "next",
    "material-ui-icons": "latest",
    "prop-types": "latest",
    "react": "15.6.2",
    "react-dom": "15.6.2",
    "react-scripts": "latest",
    "recompose": "latest",
    "typeface-roboto": "latest"
  },

如果我在一些插件中抛出上述文件,那么路径名是什么?

让我们说插件的名称是require_once(get_template_directory().'/inc/MCAPI.class.php');

1 个答案:

答案 0 :(得分:3)

要求当前插件使用__DIR__常量:
require_once(__DIR__ . '/inc/MCAPI.class.php');

要求来自其他插件或主题的文件使用WP_PLUGIN_DIR常量:require_once(WP_PLUGIN_DIR . '/plugin_name/inc/MCAPI.class.php');