how to show different menus when user is logged in and when not
-
Hi,
I’m new in wordpress and I wan’t to tweak my theme to show different menus
when user is logged in and logged out.
I found somewhere on internet that I should put this in functions.php:register_nav_menus( array(
‘primary’ => __( ‘Primary Navigation Area’, ‘twentyten’ ),
‘logged_out’ => __(‘Logged Out Area’, ‘twentyten’ )
) );and
if (is_user_logged_in() || current_user_can(‘level_10’)){
wp_nav_menu( array(
‘menu’ => ‘Primary Navigation’,
‘container_class’ => ‘primary-navigation’,
‘theme_location’ => ‘primary’
));
} else {
wp_nav_menu( array(
‘menu’ => ‘Logged Out’,
‘container_class’ => ‘logged-out’,
‘theme_location’ => ‘logged_out’
));
};But when I log out from admin it shows me a bunch of warning, for example:
Warning: Cannot modify header information – headers already sent by (output started at E:xampphtdocswordpresswp-includesnav-menu-template.php:235) in E:xampphtdocswordpresswp-login.php on line 354
Warning: Cannot modify header information – headers already sent by (output started at E:xampphtdocswordpresswp-includesnav-menu-template.php:235) in E:xampphtdocswordpresswp-login.php on line 366
Can you please give me very detail explanation (step-by-step) how to show different menus when user logged in and not?
Thanks in advance,
Amer
-
You did not specify a blog address or reason for posting when you created this topic.
This support forum is for blogs hosted at WordPress.com. If your question is about a self-hosted WordPress blog then you’ll find help at the WordPress.org forums.
If you don’t understand the difference between WordPress.com and WordPress.org, you may find this information helpful.
If you forgot to include a link to your blog, you can reply and include it below. It’ll help people to answer your question.
This is an automated message.
- The topic ‘how to show different menus when user is logged in and when not’ is closed to new replies.