wp_register()

描述

如果用户已登录,此标记将显示“站点管理”链接,如果用户未登录,则显示“注册”链接。

如果未选中管理 > 设置 > 常规 > 成员资格:任何人都可以注册框,则不提供“注册”链接。

用法

<?php wp_register( $before, $after, $echo ); ?>

参数

$before
(string) (optional) Text to display before the Register or Site Admin link.
Default: '

  • '
    $after
    (string) (optional) Text to display after the Register or Site Admin link.
    Default: '
  • '
    $echo
    (boolean) (optional) If true, echos the link, if false, returns the link as a string
    Default: true

    示例

    默认
    wp_register以列表格式

  • 显示链接。
    <?php wp_register(); ?>

    在连接前后不显示任何内容

    The following code example displays the "Register" or "Site Admin" link with no text in before or after parameters.

    <?php wp_register('', ''); ?>

    当未登录的情况下,显示输出为:

    <a href="http://www.example.com/wp-login.php?action=register">Register</a>

    当在登录状态后,显示输出为:

    <a href="http://www.example.com/wp-admin/">Site Admin</a>
  • 发表回复

    您的电子邮箱地址不会被公开。 必填项已用*标注