Visual Composer custom shortcode template - custom_markup display user input

旧街凉风 提交于 2019-12-07 09:39:37

问题


I have created some shortcode elements. Now I want to customize the look of the elements in the backend editor.

From the description of the wiki of VC-Pagebuilder, I get out that I can use the "custom_markup" param for this.

For simple html it works fine. But I can not display the user input in the shortcode backend element.

<?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"
      )
    )
   ));
  }
?>

I 'm grateful for any help .

来源:https://stackoverflow.com/questions/32745605/visual-composer-custom-shortcode-template-custom-markup-display-user-input

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!