內容簡介
當提供 Tematres API URL 時,此插件會在 WP 中辨識 Tematres 註冊的項目作為標籤可以發佈到文章中。
使用方法
安裝並啟用此外掛。前往選單「Tematres WP Integration」並設置以下條件:
– Tematres API URL
– 標籤名稱
– 將應用此標籤的文章
前端注意事項
若要在一篇使用 WordPress 的 get_the_tag_list 函數(例如 Twenty Twenty One 主題)的文章的前端返回標籤,則需要手動更改主題的範本檔案,以不調用此函數,因為它僅調用 WP 中的標籤類型為 post_tag 的標籤,這在 WP 中是標準的。因此,我們創建了函數has_tag_thematres_wp 和tmwpi_get_the_tag_list,用於查找插件創建的標籤。
在 Twenty Twenty One 主題中使用範例:
if ( has_category() || has_tag() || has_tag_tematres_wp() ) {
...
if ( function_exists( 'tmwpi_get_the_tag_list' ) ) {
$tags_list = tmwpi_get_the_tag_list( '', __( ' ', 'twentytwentyone' ) );
} else {
$tags_list = get_the_tag_list( '', __( ' ', 'twentytwentyone' ) );
}
...
}
GitHub
請在Tematres WP Integration GitHub 存儲庫上提出拉取要求或問題。
外掛標籤
開發者團隊
② 後台搜尋「Tematres WP Integration Plugin」→ 直接安裝(推薦)
原文外掛簡介
When informing a Tematres API URL, WP recognizes the terms registered in Tematres as Tags available to publish to posts.
Usage
Install and activate the plugin. Go to the “Tematres WP Integration” menu in the panel and configure the requirements:
– Tematres API URL
– Tag Name
– Post where the tags will be applied
FrontEnd Observation
To return the tags in the frontend of a post which uses, for example, the get_the_tag_list function (as the Twenty Twenty One Theme) of WordPress, it is necessary to manually change the theme’s template files, to not call this function, since it exclusively calls tags of type post_tag, which are standard in WP. So we created the functions has_tag_thematres_wp and tmwpi_get_the_tag_list that look for the tag created by the plugin.
Usage example in Twenty Twenty One theme:
if ( has_category() || has_tag() || has_tag_tematres_wp() ) {
...
if ( function_exists( 'tmwpi_get_the_tag_list' ) ) {
$tags_list = tmwpi_get_the_tag_list( '', __( ' ', 'twentytwentyone' ) );
} else {
$tags_list = get_the_tag_list( '', __( ' ', 'twentytwentyone' ) );
}
...
}
GitHub
Please reach out to make pull requests or issues on the Tematres WP Integration GitHub repository.
