php if help
-
Ok, let me start off by saying that I am new to all of this and I appreciate your patience. I am trying to add a menu to my website that is only visible to a specific role. I found this wpmu.org and it provided the base code but i cannot get it to work.
<?php if ( current_user_can( ‘delete_others_posts’ ) ) { //only admins and editors can see this ?>
- Secret Menu Item
- Other Restricted Link
<?php } else { ?>
- General Menu
- Anyone Can See This
<?php } ?>
To be honest I’m not entirely sure where i should be putting it but I’m assuming it should go where i would like the menu. I was also curious if i needed to add something to the functions.php for the if function but i assumed it would already be there. When I use the code it displays all of the listed items. Again I appreciate all of your help in advance.
**UPDATE**
You were correct. Thank you very much.
- The topic ‘php if help’ is closed to new replies.