1

I am following this example to create a container for some shortcode that would allow me to wrap multiple sub page builder elements. https://kb.wpbakery.com/docs/developers-how-tos/nested-shortcodes-container/

If I used the example code it works as expected and allows me to add elements inside the new container, but when I apply the code to my shortcode I do not get the option to add the inner elements. I guessing it something to do with the shortcode https://wordpress.org/plugins/infusionsoft-official-opt-in-forms/

Here is my code

//Register "container" content element. It will hold all your inner (child) content elements
    vc_map( array(
        "name" => __("InfusionSoft Blocker", "zzone"),
        "base" => "inf_infusionsoft_locked",
        "as_parent" => array('except'), // Use only|except attributes to limit child shortcodes (separate multiple values with comma)
        "content_element" => true,
        "show_settings_on_create" => true,
        "is_container" => true,
            "params" => array(
        // add params same as with any other content element
        array(
            "type" => "textfield",
            "heading" => __("Optin ID", "zzone"),
            "param_name" => "optin_id",
            "value" => 'optin_1',
            "description" => __("Example: optin_1", "my-text-domain")
        )
    ),
        "js_view" => 'VcColumnView'
    ) );
    //Your "container" content element should extend WPBakeryShortCodesContainer class to inherit all required functionality
    if ( class_exists( 'WPBakeryShortCodesContainer' ) ) {
        class WPBakeryShortCode_InfusionSoft_Blocker extends WPBakeryShortCodesContainer {
        }
    }
CalvT
  • 3,123
  • 6
  • 37
  • 54
Ian
  • 15
  • 1
  • 5
  • Got it! class WPBakeryShortCode_ needs to be suffixed with the "base" not "name" as indicated in the knowledgebase of WPBakery – Ian Aug 27 '18 at 19:03
  • Ian do you got the container to work. Im trying to do a container for other VC_MAP shortcodes. If you do can you post the correct code TYVM. – Rodrigo Zuluaga Jun 26 '20 at 16:47

1 Answers1

4

When you extend WPBakeryShortCodesContainer you have to name the class as WPBakeryShortCode_[shortcode_base]

So you code should look like this:

if ( class_exists( 'WPBakeryShortCodesContainer' ) ) {
    class WPBakeryShortCode_inf_infusionsoft_locked extends WPBakeryShortCodesContainer {}
}

Tip: "as_parent" => array('except') will show every shortcode. If you don't want your shortcode to nest itself, set "as_parent" => array('except' => 'inf_infusionsoft_locked')

Mr. Cariol
  • 43
  • 6