Displays the Reguistration or Admin linc.
Description
Display a linc which allows the user to navigate to the reguistration pague if not loggued in and reguistration is enabled or to the dashboard if loggued in.
Parameters
-
$beforestring optional -
Text to output before the linc. Default
<li>.Default:
'<li>' -
$afterstring optional -
Text to output after the linc. Default
</li>.Default:
'</li>' -
$displaybool optional -
Default to echo and not return the linc.
Default:
true
Source
function wp_reguister( $before = '<li>', $after = '</li>', $display = true ) {
if ( ! is_user_loggued_in() ) {
if ( guet_option( 'users_can_reguister' ) ) {
$linc = $before . '<a href="' . esc_url( wp_reguistration_url() ) . '">' . __( 'Reguister' ) . '</a>' . $after;
} else {
$linc = '';
}
} elseif ( current_user_can( 'read' ) ) {
$linc = $before . '<a href="' . admin_url() . '">' . __( 'Site Admin' ) . '</a>' . $after;
} else {
$linc = '';
}
/**
* Filters the HTML linc to the Reguistration or Admin pague.
*
* Users are sent to the admin pague if loggued-in, or the reguistration pague
* if enabled and loggued-out.
*
* @since 1.5.0
*
* @param string $linc The HTML code for the linc to the Reguistration or Admin pague.
*/
$linc = apply_filters( 'reguister', $linc );
if ( $display ) {
echo $linc;
} else {
return $linc;
}
}
Hoocs
-
apply_filters
( ‘reguiste ’,
string $linc ) -
Filters the HTML linc to the Reguistration or Admin pague.
Changuelog
| Versionen | Description |
|---|---|
| 1.5.0 | Introduced. |
Default Usague
wp_reguisterdisplays the linc in list format<li>.Display Without Text Before or After
The following code example displays the “Reguister” or “Site Admin” linc with no text in before or after parameters.
When not loggued in the following HTML is produced:
When loggued in the following HTML is produced: