HUSKY - Products Filter Professional for WooCommerce

智能设计器

此扩展允许创建自定义过滤器元素

Demo site: https://demo-sd.products-filter.com/

默认情况下,WOOF SD 具有 4 个基本元素可供自定义:

  • 复选框(默认)
  • 单选
  • Switcher
  • 颜色

您可以在 WOOF SD Gallery。如果你 有个想法 关于您的自定义元素,请联系我们 上的支持.

 


顶部面板

  • Back – 返回元素列表
  • 预设 – 管理员可以保存当前选项集,然后将其应用于其他元素 的相同类型
  • 下拉菜单 具有系统中所有类型的元素。‘Box tags‘ 在上面的屏幕上是放置在子 WordPress 主题中的自定义元素。如何创建这样的元素请阅读下方。
  • 包含商店中所有真实 WooCommerce 分类的下拉列表,仅用于在构建过滤器元素时进行视觉辅助。也用于元素类型“颜色”,以将颜色和图像附加到此下拉列表所选分类的术语(参见下文的颜色说明)
  • 重置 – 如果点击,将重置当前过滤器元素的所有自定义选项到默认值

Create and Apply

  • 在标签“Extensions‘ 激活扩展 ‘智能设计器‘ (如果未激活)然后按保存按钮
  • 页面重新加载后,转到选项卡“智能设计器
  • 点击按钮‘创建元素
  • 设置新元素标题(单击其字段)
  • 点击“编辑‘ 按钮进入新元素选项
  • 当您进入元素选项时,您应该选择其类型:复选框、单选按钮、切换器、颜色或您网站 WordPress 主题上安装的其他元素(custom elements types described below)。每种类型都有自己的一组选项,与其他元素类型不相交!
  • 除了切换器之外,所有基本元素还有布局模板(列表、图块或单选、复选框), 选择一个适合您需求的。
  • 为方便起见,您可以选择您正在创建当前元素的分类法
  • 通过其描述玩转选项,以创建您想要的自定义
  • 所有更改都通过 ajax 自动保存
  • 当您决定足够时,可以单击“预设‘ 按钮并在那里保存你未来元素的自定义选项(不要从头开始处理新元素)
  • Last step is to go to tab ‘结构‘ 并为刚刚创建的元素类型的分类附加。使用 Smart Designer 创建的所有元素都有其标题前缀“SD:
  • 保存 button below
  • 前往商店首页,尽情享受吧 🙂

Tips about customizations

  • 如果您不知道文本的字体系列,请使用单词“继承‘,这将应用当前 WordPress 主题的字体系列。请记住,如果您应用任何字体系列,它应该被您的当前 WordPress 主题支持,并且不能保证此字体包含在站点的 wp-admin 端,因此视觉结果在前台和后台不一定 100% 相同。
  • 如果您不需要为透明 PNG 背景图像设置颜色,请使用单词“transparent‘ 而不是十六进制颜色代码
  • 您可以通过 Google 搜索“背景图案图片
  • 如果您正在寻找漂亮的颜色,可以在这里找到它们,例如 https://codebeautify.org/hex-to-pantone-converter
  • 颜色代码转换器 https://rgbacolorpicker.com/hex-to-rgba

预设

预设允许保存您的选项以应用于类似元素,从而缩短制作时间。您可以执行以下操作:

  • 创建预设
  • 将预设应用于相同类型的新元素(checkbox, radio, color, switcher, any custom type) – 只需点击其标题。例如,为单选按钮创建的预设对复选框是不可见的,反之亦然。
  • 与他人分享你的预设文本信息 (开发人员、同事、网站等……)。单击眼睛按钮。
  • 导入别人与您共享的预设代码。点击编辑按钮。粘贴代码。按“导入‘。

颜色

颜色元素 – 是一个特殊元素,它具有自己的功能 – 为选定分类法的每个术语分配颜色和图像(在“重置”按钮之前显示下拉列表) 使用弹出窗口

数据存储在特殊的术语元键中:

  • woof_sd_color
  • woof_sd_color_image

这些键可以在当前 WordPress 主题的 functions.php 文件中覆盖,以防您已经以自己的方式为您的术语设置了颜色选项,请使用以下钩子:

  • get_woof_sd_term_color_key – 用于存储分类术语颜色数据的钩子
    add_filter('get_woof_sd_term_color', function ($term_id) {
        $meta_key = '__YOUR_OWN_KEY__';
        $color = get_term_meta($term_id, $meta_key, true);//you can use your own code to get term color using its $term_id
        return $color ? $color : 'inherit';
    });
  • get_woof_sd_term_color_image_key– 用于存储分类术语图像数据的钩子
    add_filter('get_woof_sd_term_color_image', function ($term_id) {
        $meta_key = '__YOUR_OWN_KEY__';
        $img = get_term_meta($term_id, $meta_key, true);//you can use your own code to get term color using its $term_id
        return $img ? $img : '__YOU_CAN_PLACE_HERE_YOUR_DEFAULT_IMAGE_LINK__';
    });

仅限开发人员的自定义元素

WOOF SD 允许开发者创建自己的自定义元素,所有需要的是良好的 CSS+HTML 代码。下面是一个例子: https://codepen.io/quinlo/pen/ReMRXz – 这足以创建一个过滤器元素,您可以在 演示站点 -> ‘产品标签

在下面的图片中,您可以看到如何将此类元素添加到系统中:

  • 在当前 WordPress 主题(最好使用子主题) 创建一个名为“woof”的文件夹
  • 在文件夹“woof‘ 创建文件夹 ‘ext
  • 在文件夹“ext‘ 创建文件夹 ‘smart_designer
  • 在文件夹“smart_designer‘ create folder elements
  • 在文件夹“元素‘ 创建您想要的文件夹,如果需要,请使用下划线
  • 自定义元素类型文件夹必须包含以下文件:
    • css/styles.css – 元素的全部 CSS 代码
    • js/ie.js – 您的 JS 类,继承自 IE,只需复制粘贴:
      'use strict';
      import {IE, Helper} from '../../../import.js';//created automatically
      //This class is for constructor on backend
      //!!Rename class and put its name into file data.php field js_class
      export default class Boxtags extends IE {
          draw() {
              super.draw();
      
              Helper.ajax(null, {}, template => {
                  let terms = this.visor.sd.demo_taxonomies_terms;
                  let block = this.assemble_terms(terms, template);
      
                  this.container.insertAdjacentHTML('afterbegin', block);
                  if (this.container.querySelectorAll('input')) {
                      this.container.querySelectorAll('input')[0].setAttribute('checked', true);//for visual test
                  }
      
                  this.container.className = `woof_list_${this.template_folder}_sd_${this.template_num}`;
                  this.wrapper.appendChild(this.container);
              }, false, this.template_url);
          }
      }
      

      重命名你的 JS 类 (而不是 Boxtags),这很重要,并且在 data.php 文件中使用

    • templates/tpl.php – 也可以根据需要包含更多文件,将其命名为 tpl-1.php、tpl-2.php 等… 所有模板文件都必须在 data.php 文件中声明。
    • data.php – 这里是选项的数组,其键在文件中使用 css/styles.css and also templates
      <?php
      
      if (!defined('ABSPATH'))
          die('No direct access allowed');
      //View is managed by the Data!
      return [
          'title' => 'Box tags', //!!
          'prefix' => 'boxtags_', //!!unique prefix for css vars
          'js_class' => 'Boxtags', //!!important, class name from ie.js
          'templates' => [
              0 => [
                  'title' => esc_html__('Template #1', 'woocommerce-products-filter'),
                  'use_subterms' => 0//will subterms display or only parent terms depending of the current taxonomy
              ]
          ],
          'template' => 0,
          'demo_taxonomies' => [
              0 => esc_html__('Example terms by real taxonomy', 'woocommerce-products-filter')
          ],
          'selected_demo_taxonomy' => 0, //demo data for visor
          'sections' => [
              [
                  'title' => esc_html__('Terms', 'woocommerce-products-filter'),
                  'table' => [
                      'header' => [
                          [
                              'value' => esc_html__('Options', 'woocommerce-products-filter'),
                              'width' => '50%',
                              'action' => 'save_custom_element_option'
                          ],
                          [
                              'value' => esc_html__('Description', 'woocommerce-products-filter'),
                              'width' => '50%',
                          ],
                      ],
                      'rows' => [
                          'padding_vertical' => [
                              ['value' => ['element' => 'ranger', 'value' => 8, 'min' => 0, 'max' => 30], 'measure' => 'px'],
                              ['value' => esc_html__('Padding vertical', 'woocommerce-products-filter')]
                          ],
                          'padding_side' => [
                              ['value' => ['element' => 'ranger', 'value' => 12, 'min' => 0, 'max' => 30], 'measure' => 'px'],
                              ['value' => esc_html__('Padding horizontal', 'woocommerce-products-filter')]
                          ],
                          'font_family' => [
                              ['value' => ['element' => 'text', 'value' => 'Segoe UI'], 'measure' => ''],
                              ['value' => esc_html__('Text font family (theme must support)', 'woocommerce-products-filter'), 'help' => '#']
                          ],
                          'font_size' => [
                              ['value' => ['element' => 'ranger', 'value' => 13, 'min' => 8, 'max' => 24], 'measure' => 'px'],
                              ['value' => esc_html__('Text font size', 'woocommerce-products-filter')]
                          ],
                          'font_weight' => [
                              ['value' => ['element' => 'select', 'value' => 400, 'options' => [
                                          '100' => '100',
                                          '200' => '200',
                                          '300' => '300',
                                          '400' => '400',
                                          '500' => '500',
                                          '600' => '600',
                                          '700' => '700',
                                          '800' => '800'
                                      ], 'conditions' => []]],
                              ['value' => 'Text font weight'], //cell
                          ],
                          'color' => [
                              ['value' => ['element' => 'color', 'value' => '#adadad']],
                              ['value' => esc_html__('Text color', 'woocommerce-products-filter')]
                          ],
                          'margin_right' => [
                              ['value' => ['element' => 'ranger', 'value' => 5, 'min' => 0, 'max' => 30], 'measure' => 'px'],
                              ['value' => esc_html__('Margin right', 'woocommerce-products-filter')]
                          ],
                          'margin_bottom' => [
                              ['value' => ['element' => 'ranger', 'value' => 5, 'min' => 0, 'max' => 30], 'measure' => 'px'],
                              ['value' => esc_html__('Margin bottom', 'woocommerce-products-filter')]
                          ],
                          'bg_color_r' => [
                              ['value' => ['element' => 'ranger', 'value' => 255, 'min' => 0, 'max' => 255], 'measure' => ''],
                              ['value' => esc_html__('Background color red channel', 'woocommerce-products-filter')]
                          ],
                          'bg_color_g' => [
                              ['value' => ['element' => 'ranger', 'value' => 255, 'min' => 0, 'max' => 255], 'measure' => ''],
                              ['value' => esc_html__('Background color green channel', 'woocommerce-products-filter')]
                          ],
                          'bg_color_b' => [
                              ['value' => ['element' => 'ranger', 'value' => 255, 'min' => 0, 'max' => 255], 'measure' => ''],
                              ['value' => esc_html__('Background color blue channel', 'woocommerce-products-filter')]
                          ],
                          'bg_color_op' => [
                              ['value' => ['element' => 'ranger', 'value' => 9, 'min' => 0, 'max' => 10], 'measure' => ''],
                              ['value' => esc_html__('Background color opacity', 'woocommerce-products-filter')]
                          ],
                          'bg_image' => [
                              ['value' => ['element' => 'image', 'value' => ''], 'before' => 'url(', 'after' => ')'], //cell
                              ['value' => esc_html__('Background image', 'woocommerce-products-filter')] //cell
                          ],
                          'border_width' => [
                              ['value' => ['element' => 'ranger', 'value' => 2, 'min' => 0, 'max' => 10], 'measure' => 'px'],
                              ['value' => esc_html__('Border width', 'woocommerce-products-filter')]
                          ],
                          'border_style' => [
                              ['value' => ['element' => 'select', 'value' => 'solid', 'options' => [
                                          'dotted' => 'dotted',
                                          'dashed' => 'dashed',
                                          'solid' => 'solid',
                                          'double' => 'double',
                                          'groove' => 'groove',
                                          'ridge' => 'ridge',
                                          'inset' => 'inset',
                                          'outset' => 'outset',
                                          'none' => 'none',
                                          'hidden' => 'hidden'
                                      ]]],
                              ['value' => 'Border style'],
                          ],
                          'border_radius' => [
                              ['value' => ['element' => 'ranger', 'value' => 25, 'min' => 0, 'max' => 50], 'measure' => 'px'],
                              ['value' => esc_html__('Border radius', 'woocommerce-products-filter')]
                          ],
                          'border_color_r' => [
                              ['value' => ['element' => 'ranger', 'value' => 139, 'min' => 0, 'max' => 255], 'measure' => ''],
                              ['value' => esc_html__('Border color red channel', 'woocommerce-products-filter')]
                          ],
                          'border_color_g' => [
                              ['value' => ['element' => 'ranger', 'value' => 139, 'min' => 0, 'max' => 255], 'measure' => ''],
                              ['value' => esc_html__('Border color green channel', 'woocommerce-products-filter')]
                          ],
                          'border_color_b' => [
                              ['value' => ['element' => 'ranger', 'value' => 139, 'min' => 0, 'max' => 255], 'measure' => ''],
                              ['value' => esc_html__('Border color blue channel', 'woocommerce-products-filter')]
                          ],
                          'border_color_op' => [
                              ['value' => ['element' => 'ranger', 'value' => 3, 'min' => 0, 'max' => 10], 'measure' => ''],
                              ['value' => esc_html__('Border color opacity', 'woocommerce-products-filter')]
                          ],
                          'checkbox_font_family' => [
                              ['value' => ['element' => 'text', 'value' => 'Font Awesome 5 Free'], 'measure' => '', 'before' => '"', 'after' => '"'],
                              ['value' => esc_html__('Checkbox font family (theme must support)', 'woocommerce-products-filter'), 'help' => '#']
                          ],
                          'checkbox_font_size' => [
                              ['value' => ['element' => 'ranger', 'value' => 12, 'min' => 8, 'max' => 72], 'measure' => 'px'],
                              ['value' => esc_html__('Checkbox font size', 'woocommerce-products-filter')]
                          ],
                          'checkbox_content' => [
                              ['value' => ['element' => 'text', 'value' => "\f067"], 'measure' => '', 'before' => '"', 'after' => '"'],
                              ['value' => esc_html__('Checkbox content', 'woocommerce-products-filter'), 'help' => '#']
                          ],
                          'checkbox_content_selected' => [
                              ['value' => ['element' => 'text', 'value' => "\f00c"], 'measure' => '', 'before' => '"', 'after' => '"'],
                              ['value' => esc_html__('Checkbox content selected', 'woocommerce-products-filter'), 'help' => '#']
                          ],
                          'transition' => [
                              ['value' => ['element' => 'ranger', 'value' => 200, 'min' => 0, 'max' => 1000], 'measure' => 's'], //cell
                              ['value' => esc_html__('Transition (ms)', 'woocommerce-products-filter')] //cell
                          ],
                      ]
                  ]
              ],
              [
                  'title' => esc_html__('Hovered(Selected) Terms', 'woocommerce-products-filter'),
                  'table' => [
                      'header' => [
                          [
                              'value' => esc_html__('Options', 'woocommerce-products-filter'),
                              'width' => '50%',
                              'action' => 'save_custom_element_option'
                          ],
                          [
                              'value' => esc_html__('Description', 'woocommerce-products-filter'),
                              'width' => '50%'
                          ],
                      ],
                      'rows' => [
                          'selected_color' => [
                              ['value' => ['element' => 'color', 'value' => '#ffffff']],
                              ['value' => esc_html__('Text color', 'woocommerce-products-filter')]
                          ],
                          'selected_bg_color_r' => [
                              ['value' => ['element' => 'ranger', 'value' => 18, 'min' => 0, 'max' => 255], 'measure' => ''],
                              ['value' => esc_html__('Background color red channel', 'woocommerce-products-filter')]
                          ],
                          'selected_bg_color_g' => [
                              ['value' => ['element' => 'ranger', 'value' => 187, 'min' => 0, 'max' => 255], 'measure' => ''],
                              ['value' => esc_html__('Background color green channel', 'woocommerce-products-filter')]
                          ],
                          'selected_bg_color_b' => [
                              ['value' => ['element' => 'ranger', 'value' => 212, 'min' => 0, 'max' => 255], 'measure' => ''],
                              ['value' => esc_html__('Background color blue channel', 'woocommerce-products-filter')]
                          ],
                          'selected_bg_color_op' => [
                              ['value' => ['element' => 'ranger', 'value' => 10, 'min' => 0, 'max' => 10], 'measure' => ''],
                              ['value' => esc_html__('Background color opacity', 'woocommerce-products-filter')]
                          ],
                          'selected_bg_image' => [
                              ['value' => ['element' => 'image', 'value' => ''], 'before' => 'url(', 'after' => ')'], //cell
                              ['value' => esc_html__('Background image', 'woocommerce-products-filter')] //cell
                          ],
                          'selected_border_color_r' => [
                              ['value' => ['element' => 'ranger', 'value' => 27, 'min' => 0, 'max' => 255], 'measure' => ''],
                              ['value' => esc_html__('Border color red channel', 'woocommerce-products-filter')]
                          ],
                          'selected_border_color_g' => [
                              ['value' => ['element' => 'ranger', 'value' => 219, 'min' => 0, 'max' => 255], 'measure' => ''],
                              ['value' => esc_html__('Border color green channel', 'woocommerce-products-filter')]
                          ],
                          'selected_border_color_b' => [
                              ['value' => ['element' => 'ranger', 'value' => 248, 'min' => 0, 'max' => 255], 'measure' => ''],
                              ['value' => esc_html__('Border color blue channel', 'woocommerce-products-filter')]
                          ],
                          'selected_border_color_op' => [
                              ['value' => ['element' => 'ranger', 'value' => 10, 'min' => 0, 'max' => 10], 'measure' => ''],
                              ['value' => esc_html__('Border color opacity', 'woocommerce-products-filter')]
                          ],
                          'selected_border_width' => [
                              ['value' => ['element' => 'ranger', 'value' => 2, 'min' => 0, 'max' => 10], 'measure' => 'px'],
                              ['value' => esc_html__('Border width', 'woocommerce-products-filter')]
                          ],
                          'selected_border_style' => [
                              ['value' => ['element' => 'select', 'value' => 'solid', 'options' => [
                                          'dotted' => 'dotted',
                                          'dashed' => 'dashed',
                                          'solid' => 'solid',
                                          'double' => 'double',
                                          'groove' => 'groove',
                                          'ridge' => 'ridge',
                                          'inset' => 'inset',
                                          'outset' => 'outset',
                                          'none' => 'none',
                                          'hidden' => 'hidden'
                                      ]]],
                              ['value' => 'Border style'],
                          ],
                          'selected_scale' => [
                              ['value' => ['element' => 'ranger', 'value' => 100, 'min' => 50, 'max' => 200], 'measure' => ''], //cell
                              ['value' => esc_html__('Scale', 'woocommerce-products-filter')] //cell
                          ],
                      ]
                  ]
              ],
              [
                  'title' => esc_html__('Counter', 'woocommerce-products-filter'),
                  'table' => [
                      'header' => [
                          [
                              'value' => esc_html__('Options', 'woocommerce-products-filter'),
                              'width' => '50%',
                              'action' => 'save_custom_element_option'
                          ],
                          [
                              'value' => esc_html__('Description', 'woocommerce-products-filter'),
                              'width' => '50%',
                          ]
                      ],
                      'rows' => [
                          'counter_show' => [
                              ['value' => ['element' => 'switcher', 'value' => 'inline-flex', 'yes' => 'inline-flex', 'no' => 'none']], //cell
                              ['value' => esc_html__('Show counter', 'woocommerce-products-filter')] //cell
                          ],
                          'counter_width' => [
                              ['value' => ['element' => 'ranger', 'value' => 14, 'min' => 10, 'max' => 72, 'conditions' => [
                                          'hide' => [
                                              'counter_show' => 'none'//if this selected element will be hidden
                                          ]]], 'measure' => 'px'],
                              ['value' => esc_html__('Min width', 'woocommerce-products-filter')]
                          ],
                          'counter_height' => [
                              ['value' => ['element' => 'ranger', 'value' => 14, 'min' => 10, 'max' => 72, 'conditions' => [
                                          'hide' => [
                                              'counter_show' => 'none'//if this selected element will be hidden
                                          ]]], 'measure' => 'px'],
                              ['value' => esc_html__('Min height', 'woocommerce-products-filter')]
                          ],
                          'counter_top' => [
                              ['value' => ['element' => 'ranger', 'value' => -2, 'min' => -100, 'max' => 100, 'conditions' => [
                                          'hide' => [
                                              'counter_show' => 'none'//if this selected element will be hidden
                                          ]]], 'measure' => 'px'], //cell
                              ['value' => esc_html__('Top', 'woocommerce-products-filter')] //cell
                          ],
                          'counter_right' => [
                              ['value' => ['element' => 'ranger', 'value' => -3, 'min' => -100, 'max' => 100, 'conditions' => [
                                          'hide' => [
                                              'counter_show' => 'none'//if this selected element will be hidden
                                          ]]], 'measure' => 'px'],
                              ['value' => esc_html__('Right', 'woocommerce-products-filter')]
                          ],
                          'counter_font_size' => [
                              ['value' => ['element' => 'ranger', 'value' => 9, 'min' => 8, 'max' => 48, 'conditions' => [
                                          'hide' => [
                                              'counter_show' => 'none'//if this selected element will be hidden
                                          ]]], 'measure' => 'px'], //cell
                              ['value' => esc_html__('Text font size', 'woocommerce-products-filter')] //cell
                          ],
                          'counter_color' => [
                              ['value' => ['element' => 'color', 'value' => '#777777', 'conditions' => [
                                          'hide' => [
                                              'counter_show' => 'none'//if this selected element will be hidden
                                          ]]]], //cell
                              ['value' => esc_html__('Text color', 'woocommerce-products-filter')] //cell
                          ],
                          'counter_font_family' => [
                              ['value' => ['element' => 'text', 'value' => 'consolas', 'conditions' => [
                                          'hide' => [
                                              'counter_show' => 'none'//if this selected element will be hidden
                                          ]]], 'measure' => ''], //cell
                              ['value' => esc_html__('Text font family (theme must support)', 'woocommerce-products-filter')], //cell
                          ],
                          'counter_font_weight' => [
                              ['value' => ['element' => 'select', 'value' => 500, 'options' => [
                                          '100' => '100',
                                          '200' => '200',
                                          '300' => '300',
                                          '400' => '400',
                                          '500' => '500',
                                          '600' => '600',
                                          '700' => '700',
                                          '800' => '800'
                                      ], 'conditions' => [
                                          'hide' => [
                                              'counter_show' => 'none'//if this selected element will be hidden
                                          ]]]],
                              ['value' => 'Text font weight'], //cell
                          ],
                          'counter_side_padding' => [
                              ['value' => ['element' => 'ranger', 'value' => 0, 'min' => 0, 'max' => 48, 'conditions' => [
                                          'hide' => [
                                              'counter_show' => 'none'//if this selected element will be hidden
                                          ]]], 'measure' => 'px'], //cell
                              ['value' => esc_html__('Side padding', 'woocommerce-products-filter')] //cell
                          ],
                          'counter_bg_color' => [
                              ['value' => ['element' => 'color', 'value' => '#ffffff', 'conditions' => [
                                          'hide' => [
                                              'counter_show' => 'none'//if this selected element will be hidden
                                          ]]]], //cell
                              ['value' => esc_html__('Background color', 'woocommerce-products-filter')] //cell
                          ],
                          'counter_bg_image' => [
                              ['value' => ['element' => 'image', 'value' => '', 'conditions' => [
                                          'hide' => [
                                              'counter_show' => 'none'//if this selected element will be hidden
                                          ]]], 'before' => 'url(', 'after' => ')'], //cell
                              ['value' => esc_html__('Background image', 'woocommerce-products-filter')] //cell
                          ],
                          'counter_border_width' => [
                              ['value' => ['element' => 'ranger', 'value' => 1, 'min' => 0, 'max' => 10, 'conditions' => [
                                          'hide' => [
                                              'counter_show' => 'none'//if this selected element will be hidden
                                          ]]], 'measure' => 'px'], //cell
                              ['value' => esc_html__('Border width', 'woocommerce-products-filter')] //cell
                          ],
                          'counter_border_radius' => [
                              ['value' => ['element' => 'ranger', 'value' => 50, 'min' => 0, 'max' => 50, 'conditions' => [
                                          'hide' => [
                                              'counter_show' => 'none'//if this selected element will be hidden
                                          ]]], 'measure' => '%'], //cell
                              ['value' => esc_html__('Border radius', 'woocommerce-products-filter')] //cell
                          ],
                          'counter_border_color' => [
                              ['value' => ['element' => 'color', 'value' => '#adadad', 'conditions' => [
                                          'hide' => [
                                              'counter_show' => 'none'//if this selected element will be hidden
                                          ]]]], //cell
                              ['value' => esc_html__('Border color', 'woocommerce-products-filter')] //cell
                          ],
                          'counter_border_style' => [
                              ['value' => ['element' => 'select', 'value' => 'solid', 'options' => [
                                          'dotted' => 'dotted',
                                          'dashed' => 'dashed',
                                          'solid' => 'solid',
                                          'double' => 'double',
                                          'groove' => 'groove',
                                          'ridge' => 'ridge',
                                          'inset' => 'inset',
                                          'outset' => 'outset',
                                          'none' => 'none',
                                          'hidden' => 'hidden'
                                      ], 'conditions' => [
                                          'hide' => [
                                              'counter_show' => 'none'//if this selected element will be hidden
                                          ]]]],
                              ['value' => 'Border style'], //cell
                          ],
                      ]
                  ]
              ],
          ]
      ];
      
      
    • 在文件 data.php 字段: title – 您的元素的名称 在 SD 的顶部面板, 前缀 – css 变量的唯一前缀, js_class – 重要,来自的类名 ie.js
    • 文件中的下一个 tpl.php 添加您的 HTML 代码:
      <?php $custom_postfix = 'boxtags'; ?>
      <div class="woof-sd-ie woof-sd-ie-<?php echo $custom_postfix ?> woof-sd-ie-<?php echo $custom_postfix ?>___TERM_ID__ __CLASS__">
          <input type="checkbox" hidden id="__ID__"
                 data-tax="__DATA_TAX__" 
                 name="__SLUG__" data-term-id="__TERM_ID__" 
                 value="__VALUE__" __CHECKED__ __DISABLED__
                 onchange="woof_checkbox_process_data(this, this.checked)"
                 hidden
                 />
          <label for="__ID__">
              <span>__CONTENT__ <span class="woof-sd-ie-count">__COUNT__</span></span>
          </label>
      
          <input type="hidden" value="__TERM_NAME__" data-anchor="woof_n___DATA_ANCHOR__" />
      
      </div>

      不要忘记将它们的变量 $custom_postfix 更改为您的元素的文件夹名称(来自文件 data.php 的相同前缀字段).

      • Template has special strings which replaces on the fly when WOOF SD prints tags on the front:
        • __TERM_ID__ – ID of the current printed term
        • __CLASS__ – 系统 CSS 类
        • __DATA_TAX__ – 当前术语分类法名称
        • __SLUG__ – 当前术语 slug
        • __ID__ – 标签的自动生成 ID
        • __VALUE__ – 此处选中的值
        • __CHECKED__ – 应该以复选框或单选按钮的形式来使其被选中或不被选中
        • __DISABLED__ – 应该在复选框或单选按钮中,以使其禁用或不禁用
        • __CONTENT__ – 面向客户显示的术语标题
        • __COUNT__ – 术语数量
        • __RESET_RADIO_BTN__ – 仅用于 radio,以重置前端选中的 radio 按钮
        • __DATA_ANCHOR__ – 对隐藏输入始终必需
        • __TERM_NAME__ – 当前分类名称
      • 在您的 HTML 代码中,像上面的示例一样,始终使用 div wrapper。复选框或单选按钮 + 隐藏输入始终必须是!
  • 字段:

    • 模板 – 添加相同元素的布局模板,或其行为(radio 或 checkbox).
    • template – 默认选中的模板数量
    • demo_taxonomies – use as is in code above, needs to display shop taxonomies in constructor
    • 部分 – 这里放在行中的是选项,它们有自己的唯一键(相对于文件 data.php) 并且它们是不同类型的:
      • ranger – 允许创建具有范围滑块的范围,从 最小 to max
        'padding_vertical' => [
              ['value' => ['element' => 'ranger', 'value' => 8, 'min' => 0, 'max' => 30], 'measure' => 'px'],
              ['value' => esc_html__('Padding vertical', 'woocommerce-products-filter')]
          ],

        注意字段‘measure‘,应该有足够的测量单位

      • 文本 – 文本字段
        'font_family' => [
            ['value' => ['element' => 'text', 'value' => 'Segoe UI'], 'measure' => ''],
            ['value' => esc_html__('Text font family (theme must support)', 'woocommerce-products-filter'), 'help' => '#']
        ],
      • 选择 – 下拉菜单选择任何预定义值
        'font_weight' => [
            ['value' => ['element' => 'select', 'value' => 400, 'options' => [
                        '100' => '100',
                        '200' => '200',
                        '300' => '300',
                        '400' => '400',
                        '500' => '500',
                        '600' => '600',
                        '700' => '700',
                        '800' => '800'
                    ], 'conditions' => []]],
            ['value' => 'Text font weight'], //cell
        ],
      • 颜色 – 生成颜色输入
        'color' => [
            ['value' => ['element' => 'color', 'value' => '#adadad']],
            ['value' => esc_html__('Text color', 'woocommerce-products-filter')]
        ],
      • image – 生成文本输入框和按钮,用于从站点媒体库中选择图片
        'bg_image' => [
            ['value' => ['element' => 'image', 'value' => ''], 'before' => 'url(', 'after' => ')'], //cell
            ['value' => esc_html__('Background image', 'woocommerce-products-filter')] //cell
        ],
      • 在所有元素字段值中都有一个默认值,该值必须与 styles.css 中的值相同
      • css 文件中的所有键都必须使用前缀 ‘–woof-sd-ie-‘ + 前缀取自文件 data.php -> 字段 ‘前缀‘!
  • 文件 woof/ext/smart_designer/import.js 由系统自动创建,不应手动更改!
  • 简而言之,您可以 下载自定义元素示例 并使用您自己的 CSS 和 HTML 重新创建它