首页 > 解决方案 > Custom element is always full width in WPBakery / Visual Composer

问题描述

I'm using the WordPress plugin WPBakery (was Visual Composer), where I've created custom elements.

In the editor side, any element can be placed in a row and it's columns can be defined from there, Is there a way to stop that?

For example, I have a custom element called hero. This block will always be col-12 and prevent anything from being places besides this block.

Trying to prevent this:

enter image description here

Is this possible?

标签: phpwordpressvisual-composer

解决方案


我找到了解决方案。

我添加了“ob_start”和“return ob_get_clean();” 在文件包含之间,这对我有用。

public static function output($atts, $content = null)
{
    extract(vc_map_get_attributes('myModule', $atts));
    ob_start();
    include_once('partials/public-display.php');
    return ob_get_clean();
}

推荐阅读