前言介紹
- 這款 WordPress 外掛「WP Conditional Shortcodes」是 2013-02-07 上架。
- 目前有 50 個安裝啟用數。
- 上一次更新是 2013-02-27,距離現在已有 4449 天。超過一年沒更新,安裝要確認版本是否可用。以及後續維護問題!
- 外掛最低要求 WordPress 2.5 以上版本才可以安裝。
- 有 4 人給過評分。
- 還沒有人在論壇上發問,可能目前使用數不多,還沒有什麼大問題。
外掛協作開發者
jrrl | tomharrigan |
外掛標籤
shortcode | shortcodes | conditional | conditional-tags |
內容簡介
這個外掛為內容開發人員提供了類似於 WordPress 主題開發提供的條件標籤的短碼。每個短碼只在特定條件為真時包括其內容。這使得他們能夠根據每個帖子的情況修改所顯示的內容。is_page、is_single 和 is_category 通過使用「ids」參數允許指定特定頁面、帖子和分類。
以下是各個短碼及其包含內容的情況:
- is_single - 如果正在顯示單個帖子。使用可選參數“ids”來指定特定的帖子。
- is_singular - 如果正在顯示單個帖子或頁面。
- is_page - 如果正在顯示頁面。使用可選參數“ids”來指定特定的頁面。
- is_home - 如果正在顯示博客主頁。
- is_front_page - 如果正在顯示網站的首頁。
- is_sticky - 如果當前的帖子或頁面是“置頂”的。
- is_category - 如果正在顯示基於分類的存檔。使用可選參數“ids”來指定特定的分類。
- is_page - 如果正在顯示頁面。
- is_tag - 如果正在顯示基於標籤的存檔。
- is_tax - 如果正在顯示基於標籤或分類的存檔。
- is_author - 如果正在顯示基於作者的存檔。
- is_archive - 如果正在顯示任何存檔。
- is_year - 如果正在顯示年度存檔。
- is_month - 如果正在顯示月度存檔。
- is_day - 如果正在顯示每日存檔。
- is_time - 如果正在顯示每小時或更短的存檔。
- is_feed - 如果正在生成訂閱。
- is_search - 如果正在顯示搜索結果。
- comments_open - 如果當前的帖子或頁面的評論是開放的。
每個短碼還有一個“else”短碼,可以放在其中。例如:
```
[is_single]
This is only shown if showing just this post.
[not_single]
This is shown everywhere else.
[/is_single]
```
is_page、is_category 和 is_single 短碼允許您指定要顯示內容的頁面、分類和帖子,如果您只想在特定頁面、帖子或分類中顯示短碼內的內容,則可以使用此功能。
例如:
```
[is_page ids="76, 339"]hello[/is_page]
[is_category ids="5, 7"]hello[/is_page]
[is_single ids="94, 63"]hello[/is_single]
```
通常,“else” 短碼只是將“is”替換為“not”。唯一的例外是 not_comments_open,它是 comments_open 的“else”短碼。
無論包含哪個內容,都會處理短碼,因此您可以使用所有其他短碼,甚至將這些短碼嵌套,如果需要的話。
更多信息,請參見 WP Conditional Shortcodes Homepage。
原文外掛簡介
This plugin gives content developers shortcode equivalents to the conditional tags that WordPress provides for theme developments. Each shortcode only includes its contents if a certain condition is true. This allows them to modify what content is shown in any given context on a post-by-post basis. is_page, is_single and is_category allow specific pages, posts, categories to be specified by using the “ids” parameter.
The shortcodes and when they include contents are:
is_single – if showing a single post. Use the optional parameter “ids” to specify specific posts.
is_singular – if showing a single post or page.
is_page – if showing a page. Use the optional parameter “ids” to specify specific pages.
is_home – if showing the blog home.
is_front_page – if showing the front page of the site.
is_sticky – if the current post or page is ‘sticky’.
is_category – if showing a category-based archive. Use the optional parameter “ids” to specify specific categories.
is_page – if showing a page.
is_tag – if showing a tag-based archive.
is_tax – if showing a tag- or category-based archive.
is_author – if showing an author-based archive.
is_archive – if showing any archive.
is_year – if showing a yearly archive.
is_month – if showing a monthly archive.
is_day – if showing a daily archive.
is_time – if showing an hourly or shorter archive.
is_feed – if generating a feed.
is_search – if showing search results.
comments_open – if comments are open for the current post or page.
Each shortcode also has an “else” shortcode that can go inside it. For example:
[is_single]
This is only shown if showing just this post.
[not_single]
This is shown everywhere else.
[/is_single]
The is_page, is_category and is_single shortcodes allow you to specify pages, categories, posts on which to show the content if you’d like to only show content within the shortcode on specific pages, posts or categories.
[is_page ids="76, 339"]hello[/is_page]
[is_category ids="5, 7"]hello[/is_page]
[is_single ids="94, 63"]hello[/is_single]
In general, the “else” shortcode is just replacing “is” with “not”. The one exception is “not_comments_open” as the “else” shortcode for “comments_open”.
Whichever chunk of content is included is processed for shortcodes, so you can use all your other shortcodes and even nest these if you need to.
Further Instructions
Any other information I have can be found at the WP Conditional Shortcodes Homepage.
各版本下載點
- 方法一:點下方版本號的連結下載 ZIP 檔案後,登入網站後台左側選單「外掛」的「安裝外掛」,然後選擇上方的「上傳外掛」,把下載回去的 ZIP 外掛打包檔案上傳上去安裝與啟用。
- 方法二:透過「安裝外掛」的畫面右方搜尋功能,搜尋外掛名稱「WP Conditional Shortcodes」來進行安裝。
(建議使用方法二,確保安裝的版本符合當前運作的 WordPress 環境。
延伸相關外掛(你可能也想知道)
mobble 》mobble 提供了與您網站相關的手機條件函數,例如 is_iphone()、is_mobile() 和 is_tablet()。, CSS 媒體查詢非常適合創建響應式網頁設計,但它們並不總是提供...。
If-So Dynamic Content Personalization 》個性化任何內容!根據訪客的個人資料或與網站的互動添加或替換內容。, 無需編程!, 創建動態內容的四種方式, , 條件觸發器-適用於每個頁面生成器-查看, 條件G...。
Elementor Element Condition 》這個外掛程式增加了在區塊和小工具中新增條件,以決定是否顯示。, 您可以使用 add_filter() 在您的 function.php 中新增自己的值。, 目前該插件相當基本,您...。
If-So Conditional Content for Elementor 》### 總結:輕鬆個性化,就在 Elementor 內部, - 輕鬆為訪客打造個性化體驗,根據位置、行為、搜索關鍵詞等動態調整 Elementor 頁面。, - 針對每位訪客量身定...。
Elementor Forms Conditional Logic 》總結文案:建立能隨著使用者填寫表單而變化的動態表單。顯示或隱藏欄位。發送某些郵件,不發送其他郵件。重定向到多個頁面。可能性無窮!, , - 特點:, - ...。
Block Logic – Full Gutenberg Block Display Control 》Block Logic 外掛在區塊編輯器(即 Gutenberg)的「進階」區段中添加了一個名為「Block Logic」的欄位,讓您可以根據條件顯示或隱藏任何區塊。您可以使用 Wor...。
Display During Conditional Shortcode 》輸入開始和結束日期/時間,您希望短碼內容在期間內顯示。選擇性地包括一個訊息或不同的內容,以便時間過去後顯示。, 短碼:, 將[display_during end_day_time...。
Extra Shipping Rates for WooCommerce 》
WordPress 外掛介紹:Extra Shipping Rates
,想要擺脫繁瑣的運費設定和固定價格結構嗎?別再猶豫!來認識一下 Extra Shipping...。
If Shortcode 》此外掛提供了「if」縮短碼來有條件地渲染內容。其語法如下:, [if condition1 condition2=false condition3]{content}[/if], , 條件作為屬性名稱傳遞。多個條...。
Conditional Tags Shortcode 》使用此簡碼,您可以控制內容顯示的位置。, 使用方法, 您可以使用 WordPress 提供的所有條件標籤。請查看下面的示例。, 僅在首頁上顯示文字:, [if is_fro...。
Composite Products – Conditional Images 》這是一款免費的小型外掛程式,適用於WooCommerce Composite Products,可以創建動態的、多層次的複合產品圖片,並根據選項更改進行響應。此外掛程式利用場景...。
GamiPress – Conditional Emails Recipients 》GamiPress - Conditional Emails Recipients 可讓您在 GamiPress - Conditional Emails 外掛中設置的電子郵件上添加自定義收件人!, 例如,當使用者解鎖特定...。
WordPress Conditional Content 》4>使用方法, 你可以在 if 簡碼(shortcode) 中放入條件式的內容,並使用其屬性來定義條件。簡碼之間的內容只有在所有已定義的條件都符合時才會顯示。, 定義...。
Block Control 》你是否曾經使用WordPress的新區塊編輯器 Gutenberg,希望有一種方式可以控制區塊顯示的時間和對象?我們曾經遇到這樣的情況,這就是為什麼我們推出了 Block C...。
ACF Conditional Logic Extended 》這款 WordPress 外掛可以擴展「群組欄位」的條件邏輯,提供一組額外的規則,並將選項值作為你的條件。, 支援欄位類型:, – 文字, – 大小文本框...。