[WordPress] 外掛分享: CMB2

WordPress 外掛 CMB2 的封面圖片。

前言介紹

  • 這款 WordPress 外掛「CMB2」是 2014-09-15 上架。
  • 目前有 300000 個安裝啟用數。
  • 上一次更新是 2024-04-02,距離現在已有 396 天。超過一年沒更新,安裝要確認版本是否可用。以及後續維護問題!
  • 外掛最低要求 WordPress 3.8.0 以上版本才可以安裝。
  • 外掛要求網站主機運作至少需要 PHP 版本 7.4 以上。
  • 有 91 人給過評分。
  • 論壇上目前有 1 個提問,問題解答率 0%

外掛協作開發者

tw2113 | jtsternberg | webdevstudios |

外掛標籤

forms | fields | options | settings | metaboxes |

內容簡介

CMB2 是一個開發人員的工具包,用於在 WordPress 上構建 metabox,自定義字段和表單,可以讓您震撼。輕鬆管理帖子、條款、用戶、評論的元數據,或創建自定義選項頁面。

CMB2 是 Custom Metaboxes and Fields for WordPress 的全新重寫。要開始使用,請按照包含的 example-functions.php 文件中的示例,並查看基本用法說明。

您可以在這裡查看可用的字段類型列表。

貢獻

開發工作在 Github 上進行,歡迎參與貢獻。請閱讀貢獻文檔以獲取更多詳細信息。

我們所有出色貢獻者的完整列表在這裡: github.com/CMB2/CMB2/graphs/contributors

特點:

創建用於帖子編輯屏幕的 metaboxes 。
創建用於選項頁面的表單。
創建用於處理用戶元數據並在用戶配置文件添加/編輯頁面上顯示的表單。
創建用於處理術語元數據的表單,並在使用您的分類法的任何地方顯示。
靈活的 API,允許您在幾乎任何地方使用 CMB 表單,甚至在前端。
包括了多種字段類型。
自定義 API 鉤子,允許您創建自己的字段類型。
有眾多的鉤子和過濾器,允許您修改庫的許多方面(無需直接編輯)。
支持大多數字段類型的可重復字段,以及可重復字段組。
CMB2 是安全的,可以與任何項目捆綁在一起。它只會在系統中加載最新版本。

翻譯

如果您要提供語言翻譯文件,請通過WordPress Plugin Translations進行。

文檔

CMB2 文檔可以在 github 的CMB2 wiki中找到。此外,如果您想閱讀代碼和行內文檔,我們嘗試使所有函數和方法完全行內文檔。

第三方資源

自定義字段類型

CMB2 Field Type: CMB Attached Posts Field,由coreymcollins提供:custom_attached_posts,用於將帖子附加到頁面上。
CMB2 Field Type: Post Search Ajax,由alexis-magina提供:post_search_ajax,將帖子附加到彼此。與CMB2 Attached Posts Field相同的方法,但使用Ajax請求,多個/單個選項和不同的UI。
CMB2 Field Type: CMB2 Post Search field:

原文外掛簡介

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.
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.
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.
Documentation

CMB2 documentation can be found at the CMB2 wiki on github. Also, If you’re into reading code and inline documentation, we tried to keep all functions and methods fully inline-documented.

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: 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: CMB2 User Search field from Mte90: user_search_text adds a user-search dialog for searching/attaching other User IDs.

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:

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
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. Also on wordpress.org.
WordPress Shortcode Button: Uses CMB2 fields to generate fields for shortcode input modals.
WDS-Simple-Page-Builder: Uses existing template parts in the currently-active theme to build a customized page with rearrangeable elements. Built with CMB2.
CMB2 Example Theme: Demonstrate how to include CMB2 in your theme, as well as some cool tips and tricks.
facetwp-cmb2: FacetWP integration with CMB2.
CMB2-grid from origgami: A grid system for WordPress CMB2 library that allows the creation of columns for a better layout in the admin.
CMB2 Metatabs Options from rogerlos: CMO makes it easy to create options pages with multiple metaboxes–and optional WordPress admin tabs.
CMB2 Conditionals from jcchavezs: Allows developers to relate fields so the display of one is conditional on the value of another.
CMB2 Metabox Code Generator from willthemoor: Skip the boring bits. Use this generator to create fully functional CMB2 metaboxes easily. Now with bulk entry!
Caldera Metaplate by CalderaWP: Not specific to CMB2, but allows creating templates for outputting your custom fields.
Yoast CMB2 Field Analysis WP Plugin by alexis-magina: This plugin adds in a js based method of recalculating Yoast SEO’s content scores when updating page content, specifically custom meta fields added via the CMB2 library.
Skeleton by awethemes: A complete framework for WordPress, uses CMB2 engine.
WP Simple Iconfonts by awethemes: An icon fonts manager and provides a font icon picker for CMB2.
CMB2 Nav Menus by nsrosenqvist: Lets you use CMB2 in nav menu entries..

Links

Project Homepage
Github project page
Documentation (GitHub wiki)
Snippet Library

View CHANGELOG
Known Issues

Metabox containing WYSIWYG editor cannot be moved or used in a repeatable way at this time (this is a TinyMCE issue).
Not all fields work well in a repeatable group.

各版本下載點

  • 方法一:點下方版本號的連結下載 ZIP 檔案後,登入網站後台左側選單「外掛」的「安裝外掛」,然後選擇上方的「上傳外掛」,把下載回去的 ZIP 外掛打包檔案上傳上去安裝與啟用。
  • 方法二:透過「安裝外掛」的畫面右方搜尋功能,搜尋外掛名稱「CMB2」來進行安裝。

(建議使用方法二,確保安裝的版本符合當前運作的 WordPress 環境。


最新版本

延伸相關外掛(你可能也想知道)

  • Redux Framework 》Redux – 快速在 WordPress 的 Gutenberg 中建立完整頁面, , 使用我們不斷更新的 WordPress 區塊模板、版面配置和模式強化 Gutenberg 編輯器。發現無限可能,...。
  • OptionTree 》OptionTree 嘗試建立一個完全響應式的選項面板和元框,經由此可讓 WordPress 開發人員、設計師和最終使用者進行連結,此外其操作簡單的方式,也不顯得像其他...。
  • Options Framework 》「Options Framework Plugin」可讓您輕鬆在任何 WordPress 主題中加入選項面板,讓開發者集中心力在製作實際主題上,而非花費時間從頭開始創建選項面板。與 W...。
  • ACF Options For Polylang 》您使用了高級自訂欄位來建立選項頁面,並且安裝了 Polylang 外掛以獲得令人驚嘆的多語言網站嗎?, 可惜的是,Polylang 並不處理 ACF 的選項頁面。這意味著您...。
  • WPS Child Theme Generator 》中文, WPS Child Theme Generator 是一款高級工具,可以輕鬆創建所需的子佈景主題。它提供許多選項,可以添加到 functions.php 中,而無需修改它。您也可以將...。
  • WP Options Importer 》目前 WordPress 可透過 WXR 匯出其所有內容,然後再透過 WordPress, 匯入外掛進行導入。這個過程包括所有文章、術語、選單、評論和使用者,, 但不碰觸選項。...。
  • AAA Option Optimizer 》,
      ,
    • 該外掛追踪頁面上使用的自動載入選項,並在頁面渲染結束時存儲該數據。它保留一個已使用的選項數組。在管理頁面上,它...。
    • Custom Global Variables 》使用此 WordPress 外掛可以建立自己的自訂變數,管理網站上的資訊,例如:, , 電話號碼, 地址, 社交媒體連結, HTML 片段, 以及其他任何資訊, , 可以輕鬆地在 ...。
    • WPC Product Options for WooCommerce 》WPC Product Options for WooCommerce 是另一個對於任何一種網店來說都適用的重要外掛程式,它帶來的是調整價格的能力,搭配高度自定義的額外欄位來應用於簡...。
    • Redux Developer Mode Disabler 》Redux 是一個非常強大的框架。為了讓開發者更輕鬆使用,我們在庫存中內建了提交通知(commit notice)。不幸的是,有些開發者在使用時開啟了這些通知,因此這個...。
    • Expand Divi 》這是一個易於使用的外掛程式,可以增加Divi主題缺少的一些主題功能。, 查看所有包含的選項:https://wajba.club/ed/home/ , 預載程式:, 在頁面載入時旋轉一...。
    • Disabler 》我不喜歡某些東西,例如彎曲的“智能”引號和自我ping。因此,我想做一個外掛來覆蓋常見的問題,而不是安裝六到七個插件。Disabler 允許你從一個簡單的 UI 中挑...。
    • Contact Details 》新增輸入聯絡資訊功能以在文章、頁面或樣板中輸出詳細資料。, 使用捷徑 [contact type="phone"] 來顯示任何聯絡詳細資訊,或使用函式呼叫
    • Transient Cleaner 》從你的 WordPress options 資料庫表格中清理已過期的 transients。這個外掛是原創且最好用的!, “Transients (翻譯中:暫存資料) 是 WordPress 中儲存...。
    • Advanced Custom Fields: Accordion Tab Field 》ACF手風琴插件提供了一種簡單的方式,通過分組在手風琴標籤中將表單中的字段組織起來。它支持水平標籤,也支持WordPress圖示。, 請在此處進行貢獻:, https:/...。

文章
Filter
Apply Filters
Mastodon