[WordPress] 外掛分享: HTML Helpers

首頁外掛目錄 › HTML Helpers
10+
安裝啟用
尚無評分
5390 天前
最後更新
問題解決
WordPress 1.5+ v0.2.3 上架:2011-05-14

內容簡介

這個外掛為 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) 的快捷方式。
此外,還有產生表單欄位的功能,包含文字、核取方塊、隱藏欄位、文字區塊和其他標籤。更多文件即將推出,現在您可以閱讀程式碼以了解其他功能。

外掛標籤

開發者團隊

⬇ 下載最新版 (v0.2.3) 或搜尋安裝

① 下載 ZIP → 後台「外掛 › 安裝外掛 › 上傳外掛」
② 後台搜尋「HTML Helpers」→ 直接安裝(推薦)
📦 歷史版本下載

原文外掛簡介

This plugin adds simple HTML tag generation API to WordPress, like these examples:
generates and prints Wordpress.
‘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.

延伸相關外掛

文章
Filter
Mastodon