Skip to content

Commit

Permalink
chore(docs): Update docs for @role
Browse files Browse the repository at this point in the history
  • Loading branch information
Log1x committed Jul 29, 2023
1 parent 87b9133 commit ed215c4
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion docs/usage/wordpress.md
Original file line number Diff line number Diff line change
Expand Up @@ -409,14 +409,20 @@ Accessing an ACF field, sub field, or even option field is just as easy:

## @role

`@role` is a simple conditional that allows you to display specific content only to users who are logged in and have a specific role. With [`wp_get_current_user()->roles`](https://developer.wordpress.org/reference/functions/wp_get_current_user/) returning an array of roles in all lowercase, the passed role is automatically lowercased using `strtolower`. It can be closed using `@endrole`.
`@role` allows you to display specific content only to users who are logged in and have a specific role. With [`wp_get_current_user()->roles`](https://developer.wordpress.org/reference/functions/wp_get_current_user/) returning an array of roles in all lowercase, the passed role is automatically lowercased using `strtolower`. It can be closed using `@endrole`.

```php
@role('author')
This content is only displayed to Authors.
@endrole
```

```php
@role('author', 'contributor')
This content is only displayed to Authors and Contributors.
@endrole
```

## @user

`@user` is a simple `is_user_logged_in()` conditional to display specific content only when a user is logged in. It can be closed using `@enduser`.
Expand Down

0 comments on commit ed215c4

Please sign in to comment.