Linux 软件免费装

If Shortcode

开发者 geomagas
更新时间 2024年8月3日 02:34
PHP版本: 3.0.1 及以上
WordPress版本: 6.6.1
版权: GPLv2 or later
版权网址: 版权信息

标签

shortcode conditional if else conditional tags

下载

0.1.0 0.2.0 0.2.1 0.3.0

详情介绍:

This plugin provides an [if] shortcode to conditionally render content. The syntax is the following: [if condition1 condition2=false condition3]{content}[/if] Conditions are passed as attribute names. Multiple conditions evaluate to the result of ORing all of them. In other words, if at least one condition evaluates to the desired boolean result, {content} is rendered, otherwise it is discarded. Attribute values determine if we want the condition to be true or false. A value of '0', 'false', '' (the empty string), 'null' or 'no' means we expect the condition to be false. Anything else, including the absense of a value, is interpreted as true. For example, suppose that we want to include a sentence in a post, but only for anonymous visitors: [if is_user_logged_in=no]The Sentence.[/if] It also provides an [else] shortcode and an [eitherway] one for use inside [if] blocks. [else] will render its content if the condition evaluates to false, and [eitherway] will render its content regardless of the evaluation result. When used outside an [if] block, these shortcodes behave as if the whole content is surrounded by an [if] shortcode whose condition evaluates to true. In other words, an [else] shortcode would not render any content, while a [eitherway] one would. You can use as many of these shortcodes as you like in a single [if] block, which gives you the ability to do things like: A multitude of conditions are supported out-of-the-box. The following evaluate to the result of the corresponding WordPress Conditional Tag, using the no-parameter syntax: is_single is_singular is_page is_home is_front_page is_privacy_policy is_attachment is_category is_tag is_tax is_author is_archive is_year is_month is_date is_day is_time is_feed is_search is_sticky is_preview has_term has_excerpt comments_open pings_open is_404 is_user_logged_in is_super_admin is_multi_author is_multisite is_main_site is_child_theme For example, the evaluation of the is_page condition is equivalent to calling is_page() with no parameter.

安装:

Install the plugin using the usual method described in the codex.

更新日志:

0.3.0 0.2.1 0.2.0 0.1.0