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?

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.