我创建了一些短代码元素。现在我想在后端编辑器中自定义元素的外观。
从VC-Pagebuilder维基的description开始,我可以使用“custom_markup”参数。
对于简单的HTML,它工作正常。但是我无法在短代码后端元素中显示用户输入。
<?php
add_shortcode('simpletext', 'simpletext_shortcode');
add_action('vc_before_init', 'simpletext_vc');
// Frontend output
function simpletext_shortcode($atts, $content = '') {
ob_start();
set_query_var('content', $content);
get_template_part('components/content', 'simpletext');
return ob_get_clean();
}
// Backend
function simpletext_vc() {
vc_map(array(
"name" => "Einfacher Text",
"base" => "simpletext",
"class" => "",
"icon" => get_template_directory_uri() ."/images/vc_icons/simpletext_icon.png",
"custom_markup" => '{{ content }}', // try to display the user input
"category" => "Text",
"params" => array(
array(
"param_name" => "content",
"heading" => "Inhalt",
"description" => "Inhalt des Elements.",
"holder" => "div",
"type" => "textarea_html"
)
)
));
}
?>
我很感激任何帮助。