所以我想在我创建的一些自定义帖子类型上包含fusion builder的帖子编辑器。有一个修复这个去fusion-core> admin> class-pagebuilder.php和编辑第53行。
var $allowed_post_types = array('page','post','avada_faq','avada_portfolio', 'add my custom types here');
但是任何时候有一个更新,这将被删除,我想不必担心这个,或担心它!所以无论如何,我可以创建一个插件助手,或添加一些东西到我的函数。php文件,不会被替换每次有更新
实例是创建文件fusion-core.php的第22行
要覆盖这个,你可以这样做:
add_action ("plugins_loaded", function () {
// unregister habitual call
remove_action( 'plugins_loaded', array( 'Fusion_Core_PageBuilder', 'get_instance' ) );
// call of the instance
// you have to change the path of the fusion-core plugin
if( ! get_option( 'avada_disable_builder' ) ) {
if ( is_admin() ) {
require_once( path of the fusion-core plugin . 'admin/class-pagebuilder.php' );
$instance = Fusion_Core_PageBuilder::get_instance();
$instance->allowed_post_types[] = "custom post type";
}
}
}, 9); // priority 9 to be called before the line of fusion-core.php
对于我来说,我发现没有必要删除操作…事实上,当我这样做的时候,它不起作用。相反,我只是调用相同的操作并更改值。我还发现我只需要"UI实例"。以下是对我有效的方法。现在,我已经成功地将页面构建器添加到我网站上的十个不同类型的帖子中,如下所示:
if ( is_admin() ) {
require_once('path to plugin directory/fusion-core/admin/class-pagebuilder.php' );
require_once('path to plugin directory/fusion-core/admin/page-builder/classes/class-ui.php' );
$ui = Fusion_Core_PageBuilder_UI::get_instance();
$ui->settings['allowed_post_types'][] = 'your_custom_post_type';
}