[WordPress] 外掛分享: YAML Custom Fields

首頁 › 外掛目錄 › YAML Custom Fields
WordPress 外掛 YAML Custom Fields 的封面圖片
全新外掛
安裝啟用
—
尚無評分
18 天前
最後更新
—
問題解決
WordPress 6.4+ PHP 8.1+ v2.0.0 上架:2025-12-31

內容簡介

YAML Custom Fields 外掛為頁面提供自訂欄位,讓編輯者能夠輕鬆填寫特定內容,如標題、團隊照片或活動日期,並在網站的適當位置顯示,提升內容管理的靈活性與效率。

【主要功能】
• 為每個頁面模板提供獨立欄位
• 支援共享欄位,適用於相同模板的所有頁面
• 允許編輯者自由添加、移除及重新排序內容區塊
• 匯出與匯入欄位及內容,便於備份或轉移
• 自動尋找缺失的圖片和檔案
• 提供 REST API 存取欄位資料

外掛標籤

開發者團隊

⬇ 下載最新版 (v2.0.0) 或搜尋安裝

① 下載 ZIP → 後台「外掛 › 安裝外掛 › 上傳外掛」
② 後台搜尋「YAML Custom Fields」→ 直接安裝(推薦)
📦 歷史版本下載

原文外掛簡介

YAML Custom Fields adds boxes to fill in on pages, like “Headline”, “Team photo” or “Event date”. Writers fill them in. The website shows them in the right place.
You list the fields of each page template in a short text, called a schema. Each field takes a few lines.
What it does

Gives each page template its own fields.
Adds fields to the header, the footer and other site parts.
Adds shared fields: one value for every page with the same template.
Keeps site details, like a phone number, for the whole site.
Lets writers build pages from sections they add, remove and reorder.
Keeps collections, like team members, for any page to pick from.
Exports and imports fields and content, for backups or moving to another site.
Finds missing images and files, and content left behind by removed fields.
Shows fields in block themes with a shortcode.
Makes fields available over the REST API.

Field types

One line of text
Several lines of text
Text with formatting (bold, links, lists)
Code, like an embed or a form
Yes or no (tick box)
Number
Date, with or without time
Dropdown
Category or tag
Kind of content (posts, pages and more)
Item from a collection
Image, or a gallery
File, or several files
Group of fields
Sections
Info box: a note for writers
Section heading: a title with a gap above it

How it works

Go to YAML CF and switch on Custom fields for a template.

Click Create schema and list the fields:
fields:

name: headline
label: Headline
type: string
name: photo
label: Photo
type: image

Open a page that uses the template. The fields are in a “Custom fields” box. In the block editor it’s below the content. In the classic editor it’s below the title.

Show each field in the theme with one line:

The Documentation page in the plugin explains every step in plain words.
Developer Documentation
The full guide is on the plugin’s Documentation page. Here’s the short version.
Functions
ycf_get_field( 'name' ) // One field
ycf_get_field( 'name', 42 ) // A field of another post
ycf_get_field( 'name', 'partial:header.php' ) // A site part
ycf_get_field( 'title', null, $section ) // A field inside a section
ycf_get_fields() // All fields
ycf_has_field( 'name' ) // Does it have a value?
ycf_get_image( 'name', null, 'large' ) // Image: id, url, alt, title, caption, width, height
ycf_get_file( 'name' ) // File: id, url, path, filename, filesize, mime_type, title
ycf_get_term( 'name' ) // Category or tag (WP_Term)
ycf_get_post_type( 'name' ) // Content type (WP_Post_Type)
ycf_get_data_object( 'name' ) // An item from a collection
ycf_get_data_objects( 'short-name' ) // Every item in a collection
ycf_get_global_field( 'name' ) // One site detail
ycf_get_global_fields() // All site details

Each function also has a long name starting with yaml_cf_.
Always escape what you print: esc_html() for text, esc_url() for links, wp_kses_post() for formatted text. Code fields print as they are.
Shortcode
[ycf field="headline"]
[ycf field="hero" size="large"]
[ycf field="phone" source="site"]
[ycf field="subtitle" default="Coming soon"]

Where data is stored

Page fields: post meta _yaml_cf_data
Schemas: option yaml_cf_schemas
Site parts: option yaml_cf_partial_data
Shared fields: options yaml_cf_template_global_schemas and yaml_cf_template_global_data
Site details: options yaml_cf_global_schema and yaml_cf_global_data
Collections: option yaml_cf_data_object_types. Each item has its own option, plus a small index per collection. Read them with ycf_get_data_objects().

Privacy Policy
YAML Custom Fields doesn’t collect or send any data. Everything stays in your WordPress database.
Third-Party Libraries

Symfony YAML (6.4), MIT license (works with GPL)

Homepage: https://symfony.com/components/Yaml
License: https://github.com/symfony/yaml/blob/6.4/LICENSE

Credits

Made by Studio Cita
Lead developer: Silvestar Bistrović

Support

Plugin documentation
Report a problem

延伸相關外掛

文章
Filter
Mastodon