[wordpress插件] Dropdown Content下拉内容

wordpress 插件 文章 2020-04-22 10:31 0 229 全屏看文

Use a shortcode to define a drop-down form field, and shortcodes to define blocks of content that will be displayed when a specific entry is selected.




To add a content dropdown to a post, you can either select the Content Dropdown icon from the TinyMCE editor, or enter the shortcodes manually.


[dropdown name="controlName" class="customClassName"] - both `name` and `class` are optional;

  [下拉名称=“ controlName” class =“ customClassName”]-名称和类都是可选的;

`name` will default to `dropdown-content`


    • the name is used to identify which content sections are targetted by this dropdown;

    • name 用于标识此下拉列表定位的内容部分;

      if there is only one dropdown on a page, it is optional;


      if there are multiple dropdowns on a page, each will need a unique name

    • 如果页面上有多个下拉菜单,则每个下拉菜单都需要一个唯一的名称

    • class can be a space-separated list of class names, or just a single class name
    • class 可以是用空格分隔的类名称列表,也可以是单个类名称

    • only [dropdown-option] shortcodes may be inside this shortcode

      [dropdown-option] 短代码可能在此短代码内

      [dropdown-option value=”someValue”] – the value field is technically optional, but is required if this option is meant to make a content block visible

      [dropdown-option value =” someValue”] –技术上, value 字段是可选的,但如果此选项旨在使内容块可见,则必填

    • must be inside a [dropdown] shortcode

      必须在 [下拉菜单] 简码

      [dropdown-content name=”controlName” value=”someValue”] – if the name matches a dropdown name, and the value matches the value of an option

      [dropdown-content name =“ controlName” value =“ someValue”] –如果 name 与下拉列表名称匹配,并且 value 与选项的值匹配

      within that dropdown, then this content will be displayed when that specific option is selected.


    • again, name is technically optional, but must match a [dropdown] name (also defaults to dropdown-content)


      name 在技术上是可选的,但必须与 [dropdown] 名称(也默认为 dropdown-content )匹配



    • value is required, and must match a value for a [dropdown-option]
    • value 是必需的,并且必须与 [dropdown-option] value 相匹配

    • can be anywhere on the page
    • 可以在页面上的任何地方



    Copy and paste the following content to see the plugin in action




    [dropdown-option]Select one…[/dropdown-option]


    [dropdown-option value=”option1″]First option[/dropdown-option]

    [dropdown-option value =” option1”]第一个选项[/ dropdown-option]

    [dropdown-option value=”option2″]Second Option[/dropdown-option]

    [dropdown-option value =” option2”]第二个选项[/ dropdown-option]



    [dropdown-content value=”option1″]Content for the first option.[/dropdown-content]

    [dropdown-content value =” option1”]第一个选项的内容。[/ dropdown-content]

    [dropdown-content value=”option2″]Content for the second option.[/dropdown-content]

    [dropdown-content value =” option2”]第二个选项的内容。[/ dropdown-content]

    Those were all using the default values from the plugin.


    Let’s change it up a bit.




    [dropdown-option value=”option1″]The First[/dropdown-option]

    [dropdown-option value =” option1”]第一个[/ dropdown-option]

    [dropdown-option value=”option2″ default=true]The Second[/dropdown-option]

    [dropdown-option value =” option2” default = true]第二[/ dropdown-option]

    [dropdown-option value=”option3″]The Third[/dropdown-option]

    [dropdown-option value =” option3”]第三[/ dropdown-option]



    You’ll notice below that the second option will be displayed by default for you.


    [dropdown-content value=”option1″]Some different content for the second first option.[/dropdown-content]

    [dropdown-content value =” option1”]第二个第一个选项的内容有所不同。[/ dropdown-content]

    [dropdown-content value=”option2″]Some different content for the second second option.[/dropdown-content]

    [dropdown-content value =” option2”]第二个第二个选项的内容有所不同。[/ dropdown-content]

    [dropdown-content value=”option3″]Some different content for the second third option.[/dropdown-content]

    [dropdown-content value =” option3”]第二个第三选项的内容有所不同。[/ dropdown-content]


The plugin is simple to install:


    1. Download the plugin, it will arrive as a zip file
    2. 下载插件,它将以zip文件格式提供

    3. Unzip it
    4. 解压缩

    5. Upload dropdown-content.zip directory to your WordPress Plugin directory
    6. dropdown-content.zip 目录上传到您的WordPress插件目录

    7. Go to the plugin management page and enable the plugin
    8. 转到插件管理页面并启用插件