內容簡介
「精選分類」意在設定一個介紹類別,以幫助識別文章的主題。此外掛會在常規文章的編輯頁面中添加一個 metabox,以選擇「精選分類」。注意,必須撰寫一些代碼才能在你的模板正確的位置顯示「精選分類」。你可以從你的模板中使用一系列呼叫的函數,在希望的頁面位置顯示「精選分類」。建立 metaboxes 需要使用 CMB2 外掛。
函數
the_featured_category() 輸入當前文章或頁面 ID,並輸出「精選分類」。
get_the_featured_category($post_id) 有一個可選參數(文章或頁面 ID),並返回「精選分類」字符串。
has_featured_category($post_id) 有一個可選參數(文章或頁面 ID),並檢查是否存在「精選分類」。
外掛標籤
開發者團隊
原文外掛簡介
The featured category is meant to set an introduction category that helps to identify the topic of a post. The plugin adds a metabox in the edit page of a regular post for selecting the featured category. Note that a small coding is required to display the featured category in the right location of your template. You can display the featured category in the desired location of the page with a set of functions that you call from your template. The plugin CMB2 is required for creating metaboxes.
Functions
the_featured_category() takes the current post or page ID and outputs the featured category.
get_the_featured_category($post_id) has one optional parameter (post or page ID) and returns the featured category as a string.
has_featured_category($post_id) has one optional parameter (post or page ID) and checks whether a featured category exists.
