百科.dev
全部条目AI 编程趋势榜开源项目技术资讯提交条目
登录
< 返回工具列表
C

CMB2

> 编程语言
开源

CMB2 是一个开发者工具包,用于为 WordPress 构建元数据框、自定义字段和表单,它会让你大开眼界。

3.0K stars0 点赞0 次浏览
访问官网GitHub

工具介绍

CMB2 是一个开发者工具包,用于为 WordPress 构建元数据框、自定义字段和表单,它会让你大开眼界。

CMB2

Contributors: jtsternberg, webdevstudios, tw2113
Homepage: https://cmb2.io
Tags: metaboxes, forms, fields, options, settings
Requires at least: 3.8.0
Requires PHP: 7.4
Tested up to: 7.0
Stable tag: 2.12.0
License: GPLv2 or later
License URI: https://www.gnu.org/licenses/gpl-2.0.html Complete contributors list found here: github.com/CMB2/CMB2/graphs/contributors

Description

CMB2 is a developer's toolkit for building metaboxes, custom fields, and forms for WordPress that will blow your mind. Easily manage meta for posts, terms, users, comments, or create custom option pages.

Download plugin on wordpress.org

CMB2 is a complete rewrite of Custom Metaboxes and Fields for WordPress. To get started, please follow the examples in the included example-functions.php file and have a look at the basic usage instructions.

You can see a list of available field types here.

If you are coming from the original "Custom Metaboxes and Fields for WordPress" plugin, please read this post for the CMB2 background story.

Contribution

Development occurs on Github, and all contributions welcome. Please read the CONTRIBUTING doc for more details.

A complete list of all our awesome contributors found here: github.com/CMB2/CMB2/graphs/contributors

Features:

  • Create metaboxes to be used on post edit screens.
  • Create forms to be used on an options pages.
  • Create forms to handle user meta and display them on user profile add/edit pages.
  • Create forms to handle term meta and display wherever your taxonomies are used.
  • Flexible API that allows you to use CMB forms almost anywhere, even on the front-end.
  • Several field types are included.
  • Custom API hook that allows you to create your own field types.
  • There are numerous hooks and filters, allowing you to modify many aspects of the library (without editing it directly).
  • Repeatable fields for most field types are supported, as well as repeatable field groups.
  • CMB2 is safe to bundle with any project. It will only load the newest version in the system.

Translation

If you are looking to provide language translation files, Please do so via WordPress Plugin Translations.

3rd Party Resources

Custom Field Types

  • CMB2 Field Type: CMB Attached Posts Field from coreymcollins: custom_attached_posts, for attaching posts to a page.

  • CMB2 Field Type: Post Search Ajax by alexis-magina: post_search_ajax Attach posts to each other. Same approach as CMB2 Attached Posts Field but with Ajax request, multiple/single option, and different UI.

  • CMB2 Field Type: CMB2 Post Search field: post_search_text adds a post-search dialog for searching/attaching other post IDs.

  • CMB2 Field Type: Ajax Search from rubengc: 3 different fields with the same UI in AJAX to search (with query parameters) to users, post type and taxonomy terms.

  • CMB2 Field Type: Google Maps from mustardBees: Custom field type for Google Maps.

    The pw_map field stores the latitude/longitude values which you can then use to display a map in your theme.

  • CMB2 Field Type: Leaflet Maps from villeristi: Custom field type for Leaflet Maps.

  • CMB2 Field Type: Select2 from mustardBees: Custom field types which use the Select2 script:

    1. The pw_select field acts much like the default select field. However, it adds typeahead-style search allowing you to quickly make a selection from a large list
    2. The pw_multiselect field allows you to select multiple values with typeahead-style search. The values can be dragged and dropped to reorder
  • CMB Field Type: Slider from mattkrupnik: Adds a jQuery UI Slider field.

  • WDS CMB2 Date Range Field from dustyf of WebDevStudios: Adds a date range field.

  • CMB2 Remote Image Select from JayWood of WebDevStudios: Allows users to enter a URL in a text field and select a single image for use in post meta. Similar to Facebook's featured image selector.

  • CMB Field Type: Sorter: This plugin gives you two CMB field types based on the Sorter script.

  • CMB Field Type: Tags: WordPress-Tags-like field type for CMB2. note: this does not set the post tags, but simply provides a unique text input

  • CMB Field Type: Link Picker: Using the Link Picker for CMB2 control, you can choose a link from your WordPress site, or manually enter a link. You can also identify if the link should open in a new window, or not.

  • CMB Field Type: MultidatesPicker: Creates a CMB2 field type that enables a multiple date calendar. It uses a plugin called MultiDatesPicker v1.6.3 for jQuery UI.

  • CMB Field Type: CMB2-radio-image: Image as radio buttons.

  • CMB2 Term Select: Special CMB2 Field that allows users to define an autocomplete text field for terms. Note: this will set the taxonomy terms, but has the option ('apply_term' => false) to disable and save the term ids as data instead (like for options pages, etc).

  • CMB2 Related Links: Allows users to add a related links via a repeating field group. Field inputs are powered by the CMB2 Field Type: CMB2 Post Search field documented above, and so each link can be populated with existing WordPress content by clicking on the search button. Note: this is not a standard field type, but instead a function you use in combination with CMB2::add_field().

  • CMB2 Field Type: Order by rubengc: Allows users to define custom order of predefined options.

  • CMB2 Field Type: Animation by rubengc: Allows users to pickup an animation from Animate.css (includes preview of chosen animation).

  • CMB2 Field Type: Ajax Search by rubengc: Based on CMB2 Field Type: Post Search Ajax, adds the ability to attach posts/users/terms, and the ability to limit the maximum number of attached objects.

  • CMB2 Field Type: Visual Style Editor by rubengc: Custom field for CMB2 which allows customizing style from a small set of controls.

  • CMB2 Field Type: Content Wrap by rubengc: Custom field for CMB2 to store a content wrap values (padding, margin or border width).

  • CMB2 Field JS Controls by rubengc: Show any field similar to Wordpress publishing actions (Post/Page post_status, visibility and post_date submit box field).

  • CMB2 Field Type: Position by rubengc: CMB2 field type to setup a jquery UI position values.

  • CMB2 Field Type: CMB2 Roadway Segments by pixelwatt: This plugin adds a new CMB2 fieldtype for drawing roadway segments onto a map and provides a shortcode for display.

  • CMB2 Field Type: Font Awesome by serkanalgur: This plugin adds a new CMB2 field type for selecting Font Awesome icons.

  • CMB2 Field Type: Typography by eduplessis: This plugin adds a new CMB2 field type "Typography" and it use jQuery fontselect for the font-family selection.

  • CMB2 Field Type: Markdown by Rekenna: This plugin adds a new CMB2 field type "CMB2 Markdown" where you can type in markdown and view a live preview of the results or convert to html with a button.

  • CMB2 Field Type: Switch Button by themevan: This plugin adds a Custom Switch Button field type for CMB2.

  • CMB2 Field Type: select_plus from manzoorwanijk: Select field type which acts much like the default select field. However, it adds the support for optgroup and saving of values with multiple attribute.

  • CMB2 Field Type: Address by scottsawyer: Just a simple, repeatable address field. It's really just the snippet from CMB2 Snippet Library converted to a plugin.

  • CMB2 Field Type: Link by scottsawyer: Create a link field with some attributes. Very nice for styling links.

  • CMB2 Field Type: Widget Selector by scottsawyer: Need a field that lets you ( or your editor ) select / display an existing widget instance? Then this is the plugin for you.

Other Helpful Resources

  • CMB2 WooCommerce HPOS Orders: Adds the ability to add custom fields to the new WooCommerce HPOS orders page.
  • CMB2 Admin Extension: Adds a UI to create CMB2 meta boxes from the WordPress admin.

GitHub Issues· 0 开放

在 GitHub 查看全部

暂无开放 Issues,或尚未同步最近议题。

核心特点

  • •Create metaboxes to be used on post edit screens.
  • •Create forms to be used on an options pages.
  • •Create forms to handle user meta and display them on user profile add/edit pages.
  • •Create forms to handle term meta and display wherever your taxonomies are used.
  • •Flexible API that allows you to use CMB forms almost anywhere, even on the front-end.
  • •Several field types are included.
  • •Custom API hook that allows you to create your own field types.
  • •There are numerous hooks and filters, allowing you to modify many aspects of the library (without editing it directly).
  • •Repeatable fields for most field types are supported, as well as repeatable field groups.
  • •CMB2 is safe to bundle with any project. It will only load the newest version in the system.

> 标签

PHPcmb2cmb2-fieldscustom-metaboxesmetaboxes

暂无评论,来聊聊你的看法吧

> 工具信息

发布日期2026年8月1日
最后更新2026年9月17日
分类编程语言
定价开源

> 相关工具

T
TypeScript
JavaScript 的超集,为前端与全栈提供静态类型
P
Python
通用编程语言,广泛用于 Web、数据与 AI
G
Go
Google 推出的简洁高效系统语言