[WordPress] 外掛分享: WAJ Links

首頁外掛目錄 › WAJ Links
全新外掛
安裝啟用
尚無評分
2533 天前
最後更新
問題解決
WordPress 4.9.8+ PHP 7.0+ v1.3.0 上架:2018-11-11

內容簡介

這個外掛包含了六種簡碼 / PHP 類別:

Link

簡碼:[link href="url"]content[/link]

PHP 類別:new WaughJ\HTMLLink\HTMLLink( $href, $content, $other_attributes );

一般連結,網址是直接使用 href 屬性提供的。是其它連結類型的基礎。

content 可以放置在開始和結束標籤中,可以是自己的簡碼,也會被解析。向 PHP 類別中傳遞可以用作字串內容的任何對象,包括其他 HTML 生成器。

可用的屬性包含所有用於 a 標籤的 HTML5 屬性 和 ...:

* anchor 屬性:為 href 添加錨點( # 之後的部分)。

* parameters 屬性:為 href 添加 GET 參數 (例如:?first_parameter = second_value&second_parameter = second_value)

* external 屬性:當值為「 true 」時,會自動添加 HTML 以在新標籤中打開連結並保護其免受攻擊(有關安全問題的更多信息,請參閱 https://www.jitbit.com/alexblog/256-targetblank-the-most-underestimated-vulnerability-ever/)。

Mail-Link

簡碼:[mail-link]email[/mail-link] 或 [mail-link email="email"]給我發電子郵件[/mail-link]。

PHP 類別:new WaughJ\HTMLMailLink\HTMLMailLink( $email, $other_attributes );

生成 mailto 連結。如果只給了電子郵件,內容自動設置為電子郵件。

可用的屬性包括“值” (直接用於 PHP 的內容),a 標籤的所有有效 HTML5 屬性,以及 Link 中提到的 external 屬性。

Phone-Link

簡碼:[phone-link]phone number[/phone-link] 或 [phone-link tel="phone"]立即聯繫我們![/phone-link]。

PHP 類別:new WaughJ\HTMLPhoneLink\HTMLPhoneLink( $phone_number, $other_attributes );

生成 tel 連結。如果只給了電話號碼,內容自動設置為電話號碼。

可用的屬性包括“值” (直接用於 PHP 的內容),a 標籤的所有有效 HTML5 屬性,以及 Link 中提到的 external 屬性。

Post-Link

簡碼:[post-link slug="post-slug"] 或 [post-link slug="post-slug" post_type="specific-post-type"][post-link post_id="post-id"]閱讀此文章[/post-link]。

PHP 類別:new WaughJ\WPPostLink\WPPostLink( $attributes );

根據 slug 或 post_id 生成到文章的連結,或使用 PHP 類別時,post 對象本身類型為“post”。

此外,您可以添加所有常規 Link 類和簡碼可以使用的屬性。

Home-Link

簡碼:[home-link] 或 [home-link]造訪我們的主頁[/home-link]。

PHP 類別:new WaughJ\WPHomeLink\WPHomeLink( $attributes );

自動生成指向 WordPress 首頁的鏈接。代表鏈接的內容默認為首頁的名稱。所有替代屬性與常規 Link 類和簡碼相同。

Category Link

簡碼:[category-link slug="category-slug"] 或 [category-link category_id="category-id"]鏈接內容[/category-link]。

PHP 類別:new WaughJ\WPCategoryLink\WPCategoryLink( $attributes );

自動產生到分類頁面的連結。使用 slug 或 category_id 屬性獲取分類。使用常規 Link 類中的內容和可選屬性添加內容。

Tag Link

簡碼:[tag-link slug="category-slug"] 或 [tag-link slug="category-slug"]鏈接內容[/tag-link]。

PHP 類別:

外掛標籤

開發者團隊

⬇ 下載最新版 (v1.3.0) 或搜尋安裝

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

原文外掛簡介

This plugin includes 6 types o’ shortcodes / PHP classes:
Link
Shortcode: [link href=”url”]content[/link]
PHP Class: new WaughJ\HTMLLink\HTMLLink( $href, $content, $other_attributes );
General link where the link href given is used directly as the href. The backbone o’ all the other link types.
Content, when put ‘tween opening & closing tags, can be a shortcode o’ its own, which will be interpreted, too. When used as a PHP class, you can push any object that can be used as a string as content, including other HTML generators.
Valid attributes include all valid HTML5 attributes for the a tag, as well as…
* an “anchor” attribute that adds an anchor to the href ( the part after the # ).
* a “parameters” attribute that adds GET parameters to the href ( i.e. ?first_parameter=second_value&second_parameter=second_value )
* an “external” attribute, which, when set to “true”, automatically adds HTML to make the link open in a new tab & protect it from hacking. ( See https://www.jitbit.com/alexblog/256-targetblank—the-most-underestimated-vulnerability-ever/ for mo’ info on security concerns ).
Mail-Link
Shortcode: [mail-link]email[/mail-link] or [mail-link email=”email”]Email Me.[/mail-link]
PHP Class: new WaughJ\HTMLMailLink\HTMLMailLink( $email, $other_attributes );
Generates mailto link. If just email given, content automatically set to email.
Valid attributes include “value” for content ( for the direct PHP use ). all valid HTML5 attributes for the a tag, as well as the external attribute mentioned under Link.
Phone-Link
Shortcode: [phone-link]phone number[/phone-link] or [phone-link tel=”phone”]Call us now![/phone-link]
PHP Class: new WaughJ\HTMLPhoneLink\HTMLPhoneLink( $phone_number, $other_attributes );
Generates tel link. If just phone # is given, content automatically set to phone #.
Valid attributes include “value” for content ( for the direct PHP use ). all valid HTML5 attributes for the a tag, as well as the external attribute mentioned under Link.
Post-Link
Shortcode: [post-link slug=”post-slug”] or [post-link slug=”post-slug” post_type=”specific-post-type”] [post-link post_id=”post-id”]Read this post[/post-link]
PHP Class: new WaughJ\WPPostLink\WPPostLink( $attributes );
Generates a link to a post, based on slug or post_id, or, if using the PHP class, the post object itself under “post”.
In addition, you can add all the attributes you can for the regular Link class & shortcode.
Home-Link
Shortcode: [home-link] or [home-link]Visit our home page.[/home-link]
PHP Class: new WaughJ\WPHomeLink\WPHomeLink( $attributes );
Automatically generates link to WordPress front page. Content that represents link defaults to name o’ front page. All alternative attributes done the same as regular Link class & shortcode.
Category Link
Shortcode: [category-link slug=”category-slug”] or [category-link category_id=”category-id”]Link content[/category-link]
PHP Class: new WaughJ\WPCategoryLink\WPCategoryLink( $attributes );
Automatically generates link to category page. Use slug or category_id attributes to get category. Content & optional attributes added the same way as regular Link class.
Tag Link
Shortcode: [tag-link slug=”category-slug”] or [tag-link slug=”category-slug”]Link content[/tag-link]
PHP Class: new WaughJ\WPTagLink\WPTagLink( $attributes );
Automatically generates link to tag page. Use slug to get tag. Content & optional attributes added the same way as regular Link class.
Media Link
Shortcode: [media-link media_id=””]Link content[/media-link] or [media-link media-id=””]Link content[/media-link] or [media-link media-id=”” value=”Link content”]
PHP Class: new WaughJ\WPMediaLink\WPMediaLink( $id, $content, $attributes );
Automatically generates link to media item. Content must be set or shortcode won’t work. Shortcode content can be put as content, too. For example, if WAJ Images is installed, you can do the common technique o’ an image link with:
[media-link media-id=”1″][upload-image id=”1″][/media-link]

延伸相關外掛

文章
Filter
Apply Filters
Mastodon