最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

plugins - Custom WPBakery elements not displaying in WP admin

programmeradmin1浏览0评论

I'm creating custom elements for WPBakery.

I have a folder called vc-elements which contains two files:

  1. hero.php
  2. text-image.php

On the WordPress admin side, I want both elements to be visible. To do this, in functions.php I'm running:

add_action( 'vc_before_init', 'vc_before_init_actions' );

function vc_before_init_actions() {

    // Link to VC elements's folder
    if( function_exists('vc_set_shortcodes_templates_dir') ){ 
        vc_set_shortcodes_templates_dir( get_template_directory() . 'vc-elements' );
    }
}

But in the admin side, neither of the two blocks show?

Previously I had:

function vc_before_init_actions() {
    require_once( get_template_directory().'/vc-elements/hero.php' );  
}

Which showed the hero block in the admin. But when I added:

function vc_before_init_actions() {
    require_once( get_template_directory().'/vc-elements/hero.php' );
    require_once( get_template_directory().'/vc-elements/text-image.php' ); 
}

In the admin side, the hero element is replaced by the text image element - only one shows at one time. Why's this?

发布评论

评论列表(0)

  1. 暂无评论