[WordPress] 外掛分享: Display custom fields in the frontend – Post and User Profile Fields

前言介紹

  • 這款 WordPress 外掛「Display custom fields in the frontend – Post and User Profile Fields」是 2017-07-23 上架。
  • 目前有 900 個安裝啟用數。
  • 上一次更新是 2024-01-12,距離現在已有 477 天。超過一年沒更新,安裝要確認版本是否可用。以及後續維護問題!
  • 外掛最低要求 WordPress 4.1 以上版本才可以安裝。
  • 有 8 人給過評分。
  • 論壇上目前有 1 個提問,問題解答率 100% ,不低,算是個很有心解決問題的開發者團隊了!

外掛協作開發者

josevega | vegacorp |

外掛標籤

acf | custom pages | custom fields | wp page templates | wordpress templates |

內容簡介

使用這款外掛,您可以使用簡碼在前端顯示文章和使用者自定欄位資料,包括高級自定欄位(ACF)欄位。

您是否想要在前端顯示來自使用者資訊的資訊?
您是否想要在前端顯示文章自定欄位?
您是否使用 Advanced Custom Fields 創建了 Metabox,並希望顯示這些欄位?

使用此外掛,可在前端顯示任何文章或使用者資訊中的欄位。

基本範例

顯示目前使用者的電子郵件:[vg_display_data key="user_email" data_source="user_data"]
顯示目前使用者的名字:[vg_display_data key="first_name" data_source="user_meta"]
顯示目前使用者的全名:[vg_display_data key="first_name,last_name" data_source="user_meta"]
顯示目前文章的標題:[vg_display_data key="post_title" data_source="post_data"]
顯示目前文章的摘要:[vg_display_data key="post_excerpt" data_source="post_data"]
顯示文章 ID = 20 的分類:[vg_display_data object_id="20" key="category" data_source="post_terms" template="Categories: {{var}}" joiner=", "]
取得特色圖片網址:[vg_display_data key="_thumbnail_id" template="Image url: {{var}}" flag="file_url"]
取得特色圖片為 標籤:[vg_display_data key="_thumbnail_id" template="Image: {{var}}" flag="image_tag"]

進階範例

從包含參數 ?post_id=任何數字的 URL 顯示貼文 ID 的標題:[vg_display_data object_id_type="query_string" object_id="post_id" key="post_title" data_source="post_data"]

從 PHP 函式取得文章或使用者 ID:[vg_display_data object_id_type="callable" object_id="function_name" key="post_title" data_source="post_data"]

使用電話號碼 = 1234(meta_key=phone AND meta_value=1234)取得目前使用者的電子郵件:[vg_display_data object_id_type="find" object_id="phone:1234" key="user_email" data_source="user_data"]

參數

object_id = 文章 ID。如果留空,則使用目前的文章。可能的值:(留空)、current、數字、如果 object_id_type=query_string,則為查詢字串鍵;如果 object_id_type=callable,則為函式名稱;如果 object_id_type=find,則為 meta_key:meta_value

object_id_type = 如果 object_id 為空、current 或為數字,則留空。可能的值:query_string,callable,find

data_source = 用於查找資料的資料庫表。預設為 post_meta。可能的值:post_data、post_meta、user_data、user_meta、post_terms。

key = 欄位鍵值。可接受一個或多個以逗號分隔的鍵值。例如,要顯示全名=first_name,last_name。必填。

template = 用於顯示欄位的 HTML 片段。如果欄位為空,則不顯示 HTML。可選。

default = 如果欄位為空,使用的預設值。可選。

joiner = 如果欄位有多個值,則會使用此項目。可選。

原文外掛簡介

UPDATE
Our plugin now includes a settings page where you must whitelist every field that you want our shortcode to display in the front end, for security reasons. Your existing shortcodes will not work until you whitelist those field keys.
The “sanitization” parameter has been removed. All the output is sanitized with wp_kses_post always.
The “wp_filter” parameter has been removed. Now we have more specific parameters like wpautop=”yes” to turn line breaks into paragraphs, and do_shortcodes=”yes” to parse shortcodes.
Display post and user custom fields data anywhere on the frontend using a shortcode, including advanced custom fields (ACF) fields.

Do you want to display information from a user profile on the frontend?

Do you want to display custom fields from a post on the frontend?

Have you created metaboxes with Advanced Custom Fields and you want to display those fields?

Use this plugin to display any field for a post or user profile on the frontend.
Basic examples

Display email of the current user: [vg_display_data key="user_email" data_source="user_data"]

Display first name of the current user: [vg_display_data key="first_name" data_source="user_meta"]

Display full name of the current user: [vg_display_data key="first_name,last_name" data_source="user_meta"]

Display the title of the current post: [vg_display_data key="post_title" data_source="post_data"]

Display the excerpt of the current post: [vg_display_data key="post_excerpt" data_source="post_data"]

Display the categories of the post ID = 20: [vg_display_data object_id="20" key="category" data_source="post_terms" template="Categories: {{var}}" joiner=", "]

Get featured image url: [vg_display_data key="_thumbnail_id" template="Image url: {{var}}" flag="file_url"]

Get featured image as tag.: [vg_display_data key="_thumbnail_id" template="Image: {{var}}" flag="image_tag"]

Advanced examples

Display the title for the post ID from the URL containing the parameter ?post_id=ANY_NUMBER: [vg_display_data object_id_type="query_string" object_id="post_id" key="post_title" data_source="post_data"]

Get email of the current user with phone number = 1234 (meta_key=phone AND meta_value=1234): [vg_display_data object_id_type="find" object_id="phone:1234" key="user_email" data_source="user_data"]

Parameters

object_id = Post ID. Leave empty to use the current post. Possible values: (empty), current, number, query string key if object_id_type=query_string, meta_key:meta_value if object_id_type=find

object_id_type = Leave empty if object_id is empty, or current, or is a number. Possible values: query_string, find

data_source = What database table to use to find the data. Default = post_meta. Possible values: post_data, post_meta, user_data, user_meta, post_terms.

key = Field key. It accepts one or multiple keys separated by commas. For example, to display full name = first_name,last_name. Required.

template = HTML fragment to use to display the field, if the field is empty the html is not displayed. Optional.

default = Default value to use if the field is empty. Optional.

joiner = If the field has multiple values, it will join the values with this string. Default ” ” (one space). Optional.

flag = Use only if the field contains a file ID to conver the ID to URL or image tag. Default values: file_url , image_tag. Optional.

wpautop = Whether to turn line breaks into paragraphs. Optional, only for advanced users.

do_shortcodes = Whether to parse shortcodes before displaying the field value. Optional, only for advanced users.

各版本下載點

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

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


1.0.0 | 1.0.1 | 1.1.0 | 1.1.1 | 1.1.2 | 1.1.3 | 1.2.0 | 1.2.1 | 1.3.0 | trunk |

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

  • Advanced Custom Fields (ACF®) 》Advanced Custom Fields 可以讓 WordPress 網站成為一個完整的內容管理系統,提供您所有工具以更好管理您的數據。, 使用 Advanced Custom Fields 外掛,完全...。
  • Meta Box 》Meta Box 是一個強大、專業又輕量級的工具組,供開發者在 WordPress 中為任何自訂文章型別建立自訂的 Meta Box 與自訂欄位。, 透過 Meta Box,您可以使用超過...。
  • Checkout Field Editor (Checkout Manager) for WooCommerce 》WooCommerce 結帳欄位編輯器外掛, WooCommerce 結帳欄位編輯器 (Checkout Manager) 外掛讓您可以在結帳頁面上添加 20 種不同類型的自訂欄位,並搭配直覺且易...。
  • Pods – Custom Content Types and Fields 》使用「Pods Framework」在一個地方管理你所有自訂內容需求。, , , 建立內容類型,包括自訂文章類型、自訂分類、以及我們專屬的「進階內容類型」(ACT),...。
  • Flexible Checkout Fields for WooCommerce – WooCommerce Checkout Manager 》我們認為 WooCommerce 是 WordPress 最好的電子商務外掛,但它缺乏一些非常基本的功能,例如使用易於使用的接口自定義結帳管理器來自訂結帳欄位。您可以使用 ...。
  • Advanced Custom Fields: Extended 》🚀 全方位增強套件,可改進WordPress和Advanced Custom Fields。此外掛旨在提供一個強大的管理框架,涵蓋了眾多改進和優化。, 此外掛需要至少 ACF Pro 5.8。,...。
  • Sydney Toolbox 》Sydney Toolbox 外掛只適用於 Sydney WordPress 主題。, 此外掛註冊了在 Sydney 主題 中所需的自定義文章類型和自定義欄位。。
  • Custom Field Suite 》Custom Field Suite (CFS) 讓您為文章添加自定義欄位。它輕量級且經過過往使用者的測試(很難出現錯誤)。, 需要了解的事項, , 我們不提供支援。, 這是一個免...。
  • Custom Field Template 》「Custom Field Template 外掛」在「編寫文章/頁面」時,新增自訂欄位的預設設定。這個模板格式基本上跟「rc:custom_field_gui 外掛」差不多,不同處在於:, ...。
  • Custom Post Types and Custom Fields creator – WCK 》WordPress Creation Kit 是由三個工具組成,可幫助您建立和維護自訂文章類型、自訂分類和最重要的是文章、頁面或自訂文章類型的自訂欄位和元框。, WCK Custom...。
  • Secure Custom Fields 》總結:SCF 是一款能夠擴展 WordPress 功能的外掛,使其成為一個靈活的內容管理工具。透過 SCF,管理自定義數據變得簡單高效。, , 1. 為什麼 SCF 是一個靈活的...。
  • JSM Show Post Metadata 》JSM's Show Post Metadata外掛會在文章編輯頁面底部顯示文章(例如文章、頁面和自訂文章類型)的meta key(也就是自訂欄位名稱)和它們的非序列化值。, ...。
  • Advanced Custom Fields: Nav Menu Field 》使用 Nav Menu Field 外掛將導覽選單加入Advanced Custom Fields (ACF)。此外掛會在 ACF(版本 5 和 4)加入 Nav Menu 欄位類型,讓您從 WordPress 管理後台...。
  • Frontend Admin by DynamiApps 》這個外掛讓你可以在前端編輯及新增文章、頁面、使用者、專有名詞欄位等等。 (之前稱為 ACF Frontend), 這個外掛允許你在網站上顯示前端管理表單,讓使用者可...。
  • Simple CSV/XLS Exporter 》本外掛可以讓您透過簡單的連結/按鈕,從後端或前端匯出文章為 CSV 或 XLS 檔案。, 請確保您使用 PHP 7.3 或更新版本,如果您看到任何錯誤,舊版本將不再受支...。

文章
Filter
Apply Filters
Mastodon