【问题标题】:Visual Composer custom markup for custom shortcode (vc_map)自定义简码 (vc_map) 的 Visual Composer 自定义标记
【发布时间】:2016-05-02 11:03:01
【问题描述】:

尝试让 custom_markup 与适用于 WordPress 的 Visual Composer 构建器一起使用。

找到Visual Composer change custom shortcode templateVisual Composer custom shortcode template - custom_markup display user input,但没有一个有答案。

这里是 vc_map 函数 https://wpbakery.atlassian.net/wiki/pages/viewpage.action?pageId=524332

的一些文档

这是我正在使用的简码,一切正常,只是在后端 ui 中看起来很糟糕

vc_map( array(
      "name" => "example",
      "base" => "adwise_vc_example",
      "class" => "",
      "category" => "Plugin name",
      "icon" => "awm_vc_icon",
      "custom_markup" => load_template( ADWISE_VC_DIR . '/vc_templates/adwise_example.php', false),
      "params" => array();

目前的样子 --> https://dl.dropboxusercontent.com/u/11204765/SS/mac/Screen%20Shot%202016-05-02%20at%2012.52.56.png

在下面的示例中,我尝试将 custom_markup 设置为 test

导致https://dl.dropboxusercontent.com/u/11204765/SS/mac/Screen%20Shot%202016-05-02%20at%2012.45.55.png

vc_map( array(
      "name" => "example",
      "base" => "adwise_vc_example",
      "class" => "",
      "category" => "Plugin name",
      "icon" => "awm_vc_icon",
      "custom_markup" => "test",
      "params" => array();

我的主要/主要问题是我不知道如何获取每个短代码的每个属性的值以显示在模板文件中。

我几乎到处都在寻找解决方案,包括浏览其他 Visual Composer 插件以了解它们是如何实现的。

任何帮助将不胜感激!

【问题讨论】:

  • 我也在尝试解决这个问题。不幸的是,您这里的所有原始链接图片似乎都是 404。
  • @TimHallman 是的,很抱歉,在 Dropbox 更改了他们的公共文件夹规则后不久,我完全停止使用 Dropbox,我不相信我有这些图像的副本。
  • 您找到解决方案了吗?
  • 不幸的是,它似乎需要一些与 WPBakery Page Builders Backbone 脚本配合使用的 JavaScript,但我从来没有让它工作。

标签: wordpress


【解决方案1】:

你到底想完成什么?从可视化作曲家核心代码来看,这是标签的自定义标记

'custom_markup' => '
<div class="wpb_tabs_holder wpb_holder vc_container_for_children">
<ul class="tabs_controls">
</ul>
%content%
</div>',

所以也许像 %customattr% 这样的东西会得到你想要的结果?

【讨论】:

  • 不确定您是否检查过屏幕截图,这是我正在尝试做的一个示例;如果您查看此屏幕截图 --> screenshot 您可以在每一行看到数字“6”,对吗?那是图像 ID,但我想要的是显示它自己的图像而不仅仅是 ID,我已经看到几个插件这样做,但无法在他们的代码中找到他们的方法。我已经尝试在我的模板中直接在 PHP 中使用 %custom%。 - @digitalzoomstudio
  • @Dym:你找到解决方案了吗?
【解决方案2】:

只需在 'params' 中添加一个带有简码属性的数组

'params' => array(
            array(
                'type' => 'textfield',
                'holder' => 'div',
                'class' => '',
                'heading' => __( 'Title' ),
                'param_name' => 'title',
                'value' => __( 'Titre' ),
                'description' => __( 'Title' ),
            ),
            array(
                'type' => 'textarea',
                'holder' => 'div',
                'class' => '',
                'heading' => __( 'Description' ),
                'param_name' => 'desc',
                'value' => __( 'description' ),
                'description' => __( 'Description' ),
            ),
            array(
                'type' => 'attach_image',
                'holder' => 'img',
                'class' => '',
                'heading' => __( 'Image' ),
                'param_name' => 'img_url',
                'value' => __( '' ),
                'description' => __( 'Image' ),
            ),

        )

如果你想在后端隐藏一个部分,只需删除 'holder' 行

【讨论】:

  • 对不起,久等了,很长时间没有得到回复,所以停止签入>。[gallery_shortcode image_ids="10,25,30,35,45,46"] 但是,来自其他 Visual Composer 插件的某些短代码实际上会在后端显示选定的图像而不仅仅是所有的ID。 @哈桑
  • 这是它在其他插件中的外观示例 --> dl.dropboxusercontent.com/u/11204765/DNT/stackoverflow/… - 但是,当我这样做时,它只显示图像 ID - URL 也会发生同样的情况,例如 --> @987654322 @@哈桑
猜你喜欢
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2015-12-21
  • 1970-01-01
  • 2018-08-20
  • 2023-03-05
  • 1970-01-01
  • 1970-01-01
相关资源
最近更新 更多