[wordpress插件] Conditional Statements条件语句

wordpress 插件 文章 2020-03-30 06:10 573 0 全屏看文

AI助手支持GPT4.0

评分
0
描述

Conditional Statements allows you to add logic into your pages.

条件语句使您可以在页面中添加逻辑。

The plugin supports various conditions allowing you to apply IF statements.

该插件支持各种条件,允许您应用IF语句。

For example: “IF the user is logged in display X ELSE display Y” would look like:

例如:“如果用户已登录,显示X ELSE,则显示Y”如下所示:

[cs-if conditions=”is-logged-in”]

[cs-if条件=“已登录”]

Welcome Back!

欢迎回来!

[gallery]

  [图库]

[else]

[else]

You must be logged in to view the gallery.

您必须先登录才能查看图库。

[/cs-if]

[/ cs-if]

You can also nest conditions e.g.

您还可以嵌套条件,例如

[cs-if conditions=”is-logged-in”]

[cs-if条件=“已登录”]

The user is logged in.

用户已登录。

[cs-if-1 conditions=”firstname”]
    

[cs-if-1条件=“名字”]
    

The user has entered a first name!
  

用户输入了名字!
  

[else-1]
    

[else-1]
    

The user must enter a first name!
  

用户必须输入名字!
  

[/cs-if-1]
  

[/ cs-if-1]
  

[cs-if-1 conditions=”lastname”]
    

[cs-if-1条件=“姓氏”]
    

The user has entered a last name!
  

用户输入了姓氏!
  

[else-1]
    

[else-1]
    

The user must enter a last name!
  

用户必须输入姓氏!
  

[/cs-if-1]

[/ cs-if-1]

[/cs-if]

[/ cs-if]

Simply add a hyphen and the depth (up to a maximum of 5) e.g.

只需添加连字符和深度(最多5个)即可,例如

[cs-if-1], [cs-if-2], [cs-if-3] and so on.

[cs-if-1],[cs-if-2],[cs-if-3]等。

Examples

示例

Please look at these examples on how to use the Conditional Statements shortcode:

请查看以下有关如何使用条件语句短代码的示例:

Examples of how to use Conditional Statements

如何使用条件语句的示例

Features

功能

    • Supports nesting of IF statements (upto 5 deep)
    • 支持IF语句的嵌套(最多5个深度)

    • AND logic.

    • 与逻辑。

      If you specify more than one condition, the conditions are AND’d (e.g. all conditions must be met for the condition to be true)

    • 如果您指定多个条件,则条件为AND(例如,必须满足所有条件才能使条件为真)

    • ELSE conditions
    • ELSE条件

    • Comparisons e.g.

    • 比较例如

      “does the post type equal ‘article'”

    • “帖子类型等于'article'”

    [cs-if conditions=”post-type” operator=”equals” compare-value=”article”]
      

    [cs-if条件=“后置类型”运算符=“等于”比较值=“文章”]
      

    Post Type is Article

    帖子类型为文章

    [else]
      

    [else]
      

    [cs-if-1 conditions=”post-type” operator=”equals” compare-value=”post”]
        

    [cs-if-1条件=“后置类型”运算符=“等于”比较值=“后置”]
        

    Post Type is Post
      

    帖子类型为帖子
      

    [else-1]
        

    [else-1]
        

    Post type is not Article or Post.
      

    帖子类型不是文章或帖子。
      

    [/cs-if-1]

    [/ cs-if-1]

    [/cs-if]

    [/ cs-if]

    Supported Conditions

    支持的条件

      • [cs-if conditions=”is-logged-in”] (supported operators: equals) – User logged in
      • [cs-if条件=”已登录”](支持的运营商:等于)–用户已登录

      • [cs-if conditions=”ip”] (supported operators: equals) – User’s IP
      • [cs-if条件=“ ip”](支持的运算符:等于)–用户的IP

      • [cs-if conditions=”first-name”] (supported operators: equals, exists, not-exists) – User’s first name
      • [cs-if条件=“名字”](支持的运算符:等于,存在,不存在)–用户的名字

      • [cs-if conditions=”last-name”] (supported operators: equals, exists, not-exists) – User’s last name.
      • [cs-if条件=“姓氏”](支持的运算符:等于,存在,不存在)–用户的姓氏。

      • [cs-if conditions=”display-name”] (supported operators: equals, exists, not-exists) – User’s display name.
      • [cs-if条件=“显示名称”](受支持的运算符:等于,存在,不存在)–用户的显示名称。

      • [cs-if conditions=”user-id”] (supported operators: equals) – User’s ID.
      • [cs-if条件=“用户ID”](支持的运算符:等于)–用户ID。

      • [cs-if conditions=”post-id”] (supported operators: equals) – Post ID of current post in loop.
      • [cs-if条件=” post-id”](支持的运算符:等于)–当前循环中的帖子ID。

      • [cs-if conditions=”post-slug”] (supported operators: equals) – Slug of current post in loop.
      • [cs-if条件=” post-slug”](支持的运算符:等于)–当前循环中的子弹。

      • [cs-if conditions=”post-type”] (supported operators: equals) – Post type of current post in loop.
      • [cs-if条件=“帖子类型”](支持的运算符:等于)–当前循环中的帖子类型。

      To suggest new conditions, email me at: email@yeken.uk

      要提出新的条件,请发送电子邮件至:email@yeken.uk

      Coming Soon

      即将推出

        • Support for ELSE IF statements
        • 支持ELSE IF语句

        • OR statements
        • OR语句

        • New conditions (please email suggestions email@yeken.uk)
        • 新情况(请给电子邮件建议email@yeken.uk)

安装步骤

    1. Login into WordPress Admin Panel
    2. 登录WordPress管理面板

    3. Navigate to Plugins > Add New
    4. 导航至插件>添加新内容

    5. Search for “Conditional Statements”
    6. 搜索“有条件的陈述”

    7. Click Install now and activate plugin
    8. 点击立即安装并激活插件

下载地址
https://downloads.wordpress.org/plugin/conditional-statements.1.0.zip
-EOF-

AI助手支持GPT4.0