[WordPress] 外掛分享: ACF Timber Integration

首頁外掛目錄 › ACF Timber Integration
WordPress 外掛 ACF Timber Integration 的封面圖片
300+
安裝啟用
★★★★★
5/5 分(1 則評價)
1863 天前
最後更新
問題解決
WordPress 3.7+ v1.4.0 上架:2017-12-18

內容簡介

這個外掛程式是針對使用 Advanced Custom Fields 和 Timber 開發佈景主題的開發人員所設計。

啟用這個外掛程式後,使用者定義的進階自訂欄位將會在 Timber context 變數中提供以下功能:

針對設定頁面所定義的欄位將會在「options」金鑰下的任何地方都可以使用
針對文章、頁面和自訂文章類型所定義的欄位將會在 Timber\Post 物件的「fields」金鑰下可以使用
針對分類所定義的欄位將會在 Timber\Term 物件的「fields」金鑰下可以使用

針對使用者所定義的欄位將會在 Timber\User 物件的「fields」金鑰下可以使用

定義的選單也會在「menus」金鑰下提供所有地方都可以使用

此外,它還增加了用於圖像的 twig functions:

srcset – 用於生成 srcset 屬性標籤。
用法:<img src="{{ post.thumbnail.src('large') }}" {{ srcset(post.thumbnail,'large') }} />
image_attr – 用於生成 srcset、width、height 和 alt。
用法:<img src="{{ post.thumbnail.src('large') }}" {{ image_attr(post.thumbnail,'large') }} />

外掛標籤

開發者團隊

⬇ 下載最新版 (v1.4.0) 或搜尋安裝

① 下載 ZIP → 後台「外掛 › 安裝外掛 › 上傳外掛」
② 後台搜尋「ACF Timber Integration」→ 直接安裝(推薦)

原文外掛簡介

This plugin is intended for developers that are using Advanced Custom Fields and Timber to develop their themes.
By enabling this plugin the user-defined advanced custom fields will be available in the Timber context variable as follows:

Fields defined for settings pages will be available everywhere under the “options” key
Fields defined for posts, pages and custom post types will be available on the \Timber\Post object under the “fields” key
Fields defined for terms will be available on the \Timber\Term object under the “fields” key

Fields defined for users will be available on the \Timber\User object under the “fields” key

Defined menus will also be available everywhere under the “menus” key

Also adds twig functions for images:

srcset – used to generate srcset attribute tag.
Usage:
image_attr – used to generate srcset, width, height and alt.
Usage:

延伸相關外掛

文章
Filter
Mastodon