內容簡介
使用簡單的 [http-url] 短碼,將任何 URL 轉換為 HTTP 或 HTTPS。
短碼
[http-url]
預設情況下,[http-url] 短碼會輸出當前文章的 URL 並轉換為 HTTP。注意:必須在循環內使用。
短碼屬性
url – 手動指定需要轉換的 URL(可在循環外使用):
[http-url url=”https://mysite.com”]
to_https – 將 URL 轉換為 HTTPS 而非 HTTP:
[http-url to_https=”true”]
PHP 使用
HTTP URLs 還提供了兩個可用於 PHP 中的函數:
hu_get_http_url( $url ); // 返回轉換為 HTTP 的 URL
hu_get_https_url( $url ); // 返回轉換為 HTTPS 的 URL
為什麼使用此外掛?
此外掛最常用的情況是與社交媒體分享/評論外掛一起使用,其中數據與特定 URL 相關聯。對於同時通過 HTTP 和 HTTPS 可見的網站,這意味著每個頁面有兩個不同的數據集被創建。HTTP URLs 為這個常見的問題提供了方便的解決方案。 了解更多 →
外掛標籤
開發者團隊
原文外掛簡介
Use the simple [http-url] shortcode to convert any URL to either HTTP or HTTPS.
The Shortcode
[http-url]
By default the [http-url] shortcode will output the URL of the current post converted to HTTP. Note: must be used within the loop.
Shortcode Attributes
url – manually specify the URL to be converted (can be used outside the loop):
[http-url url=”https://mysite.com”]
to_https – convert URL to HTTPS, instead of to HTTP:
[http-url to_https=”true”]
PHP Usage
HTTP URLs also provides two functions that can be used in your php:
hu_get_http_url( $url ); // Returns URL converted to HTTP
hu_get_https_url( $url ); // Returns URL converted to HTTPS
Why Use This Plugin?
The most common case for using this plugin is in conjunction with social media sharing/commenting plugins, in which data is tied to a specific URL. On sites that are visible via both HTTP and HTTPS, this means that two different sets of differing data are created for every page. HTTP URLs provides a handy solution to this common problem. Learn More →
