
內容簡介
Shadow Terms 可以為支援的文章類型註冊自訂(影子)分類法。這些分類法可用於關聯各種文章類型的相關內容。
當建立新的支援文章類型的文章時,也會建立一個反映該文章的術語。當編輯支援此分類法的另一種文章類型時,可以指定此術語以關聯文章。
Shadow Terms 預設不會註冊任何文章類型的支援。必須在外掛或佈景主題中添加自訂代碼。
可以使用以下代碼為自訂文章類型添加支援:
`
<?php
// 正常註冊組織文章類型。
register_post_type( '‘organization’', $args );
// 為組織文章類型添加 Shadow Terms 支援。
add_post_type_support(
'‘organization’',
'‘shadow-terms’',
array(
// 添加支援 organization_connect 分類法的文章類型。
'‘person’',
'‘press-release’',
)
);
`
使用以上示例,每當建立一個 organization 時,都會在 organization_connect 分類法下建立一個同名術語。當編輯人員或新聞稿時,該術語可以通過標準的 WordPress 分類介面指定。
然後可以編寫代碼來查詢和顯示與組織相關的所有人員或新聞稿。
外掛標籤
開發者團隊
原文外掛簡介
Shadow Terms registers custom (shadow) taxonomies for supported post types. These taxonomies can be used to associate related content from a variety of post types.
When a new post of a supported post type is created, a term mirroring that post is also created. When editing another post type that supports this taxonomy, this term can be assigned to associate the posts.
Shadow Terms does not register support for itself on any post types by default. Custom code must be added to a plugin or theme.
Support can be added to a custom post type with code like:
