[WordPress] 外掛分享: Display Custom Fields

首頁外掛目錄 › Display Custom Fields
全新外掛
安裝啟用
☆☆☆☆
1/5 分(1 則評價)
5176 天前
最後更新
問題解決
WordPress 3.3+ v0.1 上架:2012-01-14

內容簡介

這個外掛程式可以直接使用,但假設您需要一些 CSS 和開發人員自訂來符合您網站的特定需求。

樣式可以透過您的佈景主題的 style.css 檔案進行覆寫。

功能可以透過您的佈景主題的 functions.php 檔案進行覆寫。

"範例"

在 "product" 文章類型不顯示 metabox:

add_filter( 'display_custom_fields', 'bb_no_product_metabox' ); function bb_no_product_metabox( $true, $post ) { if ( $post->post_type == 'product' ) return false; return true; }

不要顯示 product_id 的 postmeta

add_filter( 'dcf_postmeta', 'bb_no_product_id' ); function bb_no_product_id( $postmeta ) { unset( $postmeta['product_id'] ); return $postmeta; }

不要顯示 metabox 標題

add_filter( 'dcf_heading', '__return_false' );

在內容下方顯示 metabox (而非靠右浮動)

add_filter( 'dcf_before_content', '__return_false' );

外掛標籤

開發者團隊

⬇ 下載最新版 (v0.1) 或搜尋安裝

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

原文外掛簡介

This plugin will work, “as is”, out of the box, but assumes some level of CSS and developer customization to adapt to your site’s specific needs.
Styles can be overridden via your theme’s style.css
Functionality can be overridden via your theme’s functions.php
”Examples”
Don’t display metabox on “product” post type:
add_filter( 'display_custom_fields', 'bb_no_product_metabox' ); function bb_no_product_metabox( $true, $post ) { if ( $post->post_type == 'product' ) return false; return true; }
Don’t display the product_id metakey
add_filter( 'dcf_postmeta', 'bb_no_product_id' ); function bb_no_product_id( $postmeta ) { unset( $postmeta['product_id'] ); return $postmeta; }
Don’t display metabox title
add_filter( 'dcf_heading', '__return_false' );
Display metabox below content (rather than floated to the right)
add_filter( 'dcf_before_content', '__return_false' );

延伸相關外掛

文章
Filter
Mastodon