Skip to main content
replaced http://wordpress.stackexchange.com/ with https://wordpress.stackexchange.com/
Source Link

I would like to open a modal/popup on my homepage but only to specific users using their roles.

I have a plugin (CP Poll) and I would like only some people to see it. It gives me a shortcode. For example, editors, and show them only once. How can I do that ? I've tried using many extensions but none of them helped me to aim only specific roles. I've also tried with this code

<?php if( current_user_can('editor') || current_user_can('administrator') ) {  ?> 
// stuff here for admins or editors
<?php } ?>

That I've found herehere but it doesn't work.

Thank you

I would like to open a modal/popup on my homepage but only to specific users using their roles.

I have a plugin (CP Poll) and I would like only some people to see it. It gives me a shortcode. For example, editors, and show them only once. How can I do that ? I've tried using many extensions but none of them helped me to aim only specific roles. I've also tried with this code

<?php if( current_user_can('editor') || current_user_can('administrator') ) {  ?> 
// stuff here for admins or editors
<?php } ?>

That I've found here but it doesn't work.

Thank you

I would like to open a modal/popup on my homepage but only to specific users using their roles.

I have a plugin (CP Poll) and I would like only some people to see it. It gives me a shortcode. For example, editors, and show them only once. How can I do that ? I've tried using many extensions but none of them helped me to aim only specific roles. I've also tried with this code

<?php if( current_user_can('editor') || current_user_can('administrator') ) {  ?> 
// stuff here for admins or editors
<?php } ?>

That I've found here but it doesn't work.

Thank you

Source Link

Show modal only to some roles

I would like to open a modal/popup on my homepage but only to specific users using their roles.

I have a plugin (CP Poll) and I would like only some people to see it. It gives me a shortcode. For example, editors, and show them only once. How can I do that ? I've tried using many extensions but none of them helped me to aim only specific roles. I've also tried with this code

<?php if( current_user_can('editor') || current_user_can('administrator') ) {  ?> 
// stuff here for admins or editors
<?php } ?>

That I've found here but it doesn't work.

Thank you