Check if the user is logged in and has a specific role

<?php
// Navigation items only for scheme providers
  if ( is_user_logged_in() ) {
              
    if ( current_user_can( 'favourite_schemes' ) ) {
  			if ( function_exists('has_nav_menu') && has_nav_menu('teachers-menu') ) {
  				wp_nav_menu( array( 'sort_column' => 'menu_order', 'container' => 'ul', 'menu_id' => 'main-nav', 'menu_class' => 'nav fl', 'theme_location' => 'teachers-menu' ) );
  			}
      //} elseif ( current_user_can( 'delete_others_posts' ) ) {
          
      } else {
          
      }
      
  } else {
    // Do nothing - they're not logged in
  }
?>

Revisions

There are no revisions for this post.

Tags: , ,

No comments yet.

Leave a Reply