內容簡介
這個外掛為 WordPress 新增了一個簡單的 HTML 標籤產生 API,像以下這些例子:
產生並列印 <img src="/wp-content/<your-theme>/images/wordpress.png" alt="Wordpress" />。
tag_func('my-image', 'absolute_url', 'id', 'alt_text')) 會產生類似的標籤,只是有手動設定絕對 URL、ID 及 alt 屬性。
tag_func('select', array('name' => 'my_cat'), $term_id)) 會產生選擇標籤,其中選項從 WP 的「category」分類法中取得並將 $term 設為所選擇的項目。
類似 Rails 的「cycle」會在第一次呼叫時回傳「odd」,第二次呼叫回傳「even」,再呼叫一次回傳「odd」,以此類推。reset_cycle 會重新開始週期。
快速輸出 get_post_meta($id, 'meta_name', true) 的快捷方式。
此外,還有產生表單欄位的功能,包含文字、核取方塊、隱藏欄位、文字區塊和其他標籤。更多文件即將推出,現在您可以閱讀程式碼以了解其他功能。
外掛標籤
開發者團隊
原文外掛簡介
This plugin adds simple HTML tag generation API to WordPress, like these examples:
generates and prints
.
‘my-image’)) ?> generates and returns almost the same tag, just with absolute url, id and alt attributes set manually.
term_id) ?> generates select tag with options taken from WP ‘category’ taxonomy and sets $term as selected item
rails-like “cycle” that returns “odd” on first call, “even” on second, “odd” on
third call, so on. reset_cycle resets the cycle.
shortcut for echo(get_post_meta($id, ‘meta_name’, true))
Form field generators for text, checkbox, hidden input types, textarea, and more tags. More docs coming soon, you can read the code to figure out other features for now.
