How to switch between two forms for visitor once admin logged in?
I have two forms (form1
and form2
). Once the admin is logged in anywhere, all visitors (not logged in) to my WordPress site should see form1
on the page, otherwise they should see form2
. I am using this code in a custom page template:
if ( current_user_can( 'author' ) || current_user_can( 'administrator' ) ) {
// show form1
} else {
// show form2
}
This works fine, but only for the admin screen, not other users or visitors. How can I make this universal?