[wordpress插件] Administrative Shortcodes行政简码

wordpress 插件 文章 2020-02-04 20:20 688 0 全屏看文

AI助手支持GPT4.0

评分

0

0

描述

A set of shortcodes for the website administrators.

网站管理员的一组短代码。

if

如果

Using this shortcode you can limit the display of the text or shortcodes to specific page(s) on your website.

使用此简码,您可以将文本或简码的显示限制为网站上特定页面的显示。

You can use all the conditional tags WordPress provides.

您可以使用WordPress提供的所有条件标记

Checkout examples below.

下面的结帐示例。

Show text only on the homepage:
    

仅在首页上显示文本:
    

[if is_front_page] The text [/if]

[if is_front_page]文本[/ if]

Show text only on the About page of the site:
    

仅在网站的“关于”页面上显示文本:
    

[if is_page=”about”] The text [/if]

[if is_page =“ about”]文本[/ if]

Show only on the category archive view:
    

仅在类别归档视图中显示:
    

[if is_category] The text [/if]

[if is_category]文本[/ if]

You can add “not_” before the conditional tag to reverse the logic, example:

您可以在条件标记之前添加“ not_”以反转逻辑,例如:

Show on all pages of the site except the homepage:
    

在网站的所有页面上显示,首页除外:
    

[if not_is_front_page] The text [/if]

[if not_is_front_page]文本[/ if]

Using multiple parameters, the content is displayed when either of the conditions are met (“OR” comparison), for example, show text on both category and tag archive pages:
    

使用多个参数,当满足两个条件中的任何一个(“ OR”比较)时,将显示内容,例如,在类别和标签归档页面上显示文本:
    

[if is_category is_tag] The text [/if]

[if is_category is_tag]文本[/ if]

To set multiple conditions you can nest the shortcode, for example show text only on homepage AND if the user is logged in:
    

要设置多个条件,可以嵌套简码,例如仅在首页上显示文本,并且如果用户已登录,则显示以下文本:
    

[if is_user_logged_in][if is_front_page] The text [/if][/if]

[if is_user_logged_in] [if is_front_page]文本[/ if] [/ if]

Show a link to wordpress.org site, only on single post pages and only on mobile devices:
    

仅在单个帖子页面上和仅在移动设备上显示到wordpress.org网站的链接:
    

[if wp_is_mobile][if is_single] WordPress [/if][/if]

[if wp_is_mobile] [if is_single] WordPress [/ if] [/ if]

switch_to_blog

switch_to_blog

Run shortcodes in the context of another website in the network.

在网络中另一个网站的上下文中运行简码。

This shortcode is only available in multisite installations (WP Network).

此短代码仅在多站点安装(WP网络)中可用。

For example, list posts from another blog:
    

例如,列出另一个博客的帖子:
    

[switch_to_blog id=”10″] [list_posts limit=”10″] [/switch_to_blog]

[switch_to_blog id =” 10”] [list_posts limit =“ 10”] [/ switch_to_blog]

iterator

迭代器

Display text or shortcodes only if repeated a certain number of times.

仅在重复一定次数后才显示文本或简码。

Requires an “id” parameter which should be unique for that shortcode (can be anything you want).
    

需要一个“ id”参数,该参数对于该短码应该是唯一的(可以是您想要的任何东西)。
    

[iterator id=”my-ads” repeat=”5″] My ad codes [/iterator]

[iterator id =“ my-ads” repeat =“ 5”]我的广告代码[/ iterator]

After every 5th call to that shortcode, render the output.

在第5次调用该短代码后,呈现输出。

get_template

get_template

Load a template file into the page.

将模板文件加载到页面中。

The referenced file is loaded from child theme if it exists, if not from the parent theme.

如果存在子主题,则从子主题加载引用的文件;如果不存在,则从父主题加载。

Example, load includes/slider.php template file from the theme:
    

例如,从主题加载include / slider.php模板文件:
    

[get_template slug=”includes/slider”]

[get_template slug =” includes / slider”]

scheduler

调度程序

Show text or shortcodes only if the specified date has passed.

仅在指定的日期过去后才显示文本或简码。

Example, show the text only if it’s after Christmas of 2016:
    

例如,仅在2016年圣诞节后显示文本:
    

[scheduler date=”December 25, 2016″] Text [/scheduler]

[scheduler date =” 2016年12月25日”]文本[/ scheduler]

date

日期

Shows the current date or time in the specified format (https://codex.wordpress.org/Formatting_Date_and_Time).

以指定的格式(https://codex.wordpress.org/Formatting_Date_and_Time)显示当前日期或时间。

Uses Date Format (in Settings > General) by default.
    

默认使用日期格式(在“设置”>“常规”中)。
    

[date format=”F j, Y”]

[日期格式=“ F j,Y”]

loginoutlink

loginoutlink

Display a link to login page if user is not logged-in, or a logout page if they are.

如果用户未登录,则显示指向登录页面的链接,如果用户未登录,则显示退出页面。

Parameters:

参数:

    • login : “Log in” text
    • 登录:“登录”文本

    • logout : “Log out” text
    • 注销:“注销”文本

    • redirect : optional URL to redirect to on login or logout
    • redirect:登录或注销时重定向到的可选URL

    login_form

    login_form

    Display the login form.

    显示登录表单。

    custom_field

    custom_field

    Display a custom field from a post.

    显示帖子中的自定义字段。

    Parameters:

    参数:

      • key : name of the custom field to show.

      • key:要显示的自定义字段的名称。

        This parameter is required.

      • 此参数是必需的。

      • post_id : the ID of the post to display the custom field from;

      • post_id:从中显示自定义字段的帖子的ID;

        by default uses the current post in the loop

      • 默认情况下在循环中使用当前帖子

      • before : show a text to display before the value of the field
      • 之前:在字段值之前显示要显示的文本

      • after : show a text after the value of the field
      • 之后:在字段值之后显示文本

      disable

      禁用

      Wrap any content or shortcode with [disable] shortcode to prevent that piece of content from being rendered.

      使用 [disable] 短码包装任何内容或简码,以防止呈现该段内容。

      Perfect for debugging shortcodes.

      非常适合调试简码。

      the_id

      the_id

      Shows the current post ID;

      显示当前帖子ID;

      useful when you need to debug WP Loops.

      在需要调试WP循环时很有用。

      Path shortcodes

      路径短代码

      [home_url] : returns the homepage URL

      [home_url]:返回主页URL

      [get_template_directory] : Absolute path to the parent theme directory

      [get_template_directory]:父主题目录的绝对路径

      [get_template_directory_uri] : URL to the directory of the parent theme

      [get_template_directory_uri]:父主题目录的URL

      [get_stylesheet_directory] : Absolute path to the directory of the child theme

      [get_stylesheet_directory]:子主题目录的绝对路径

      [get_stylesheet_directory_uri] : URL to the directory of the child theme

      [get_stylesheet_directory_uri]:子主题目录的URL

      rand shortcodes

      rand短代码

      Show a random number between two numbers.

      显示两个数字之间的随机数。

      Parameters:

      参数:

      * min : minimum value (default 0)

      * min:最小值(默认为0)

      * max : maximum value (default 100)

      * max:最大值(默认100)

安装步骤

    1. Upload the the plugin directory to the /wp-content/plugins/ directory
    2. 将插件目录上传到 / wp-content / plugins / 目录

    3. Activate the plugin through the ‘Plugins’ menu in WordPress
    4. 通过WordPress中的“插件”菜单激活插件

    5. Enjoy!
    6. 享受!

下载地址

https://downloads.wordpress.org/plugin/administrative-shortcodes.zip

https://downloads.wordpress.org/plugin/administrative-shortcodes.zip

-EOF-

AI助手支持GPT4.0