Problems with showing different navigation menus


I wanted to achive two different header menus, one for logged in users, and one for the others.
So I found this code snippet:

function my_wp_nav_menu_args( $args ) {
if( is_user_logged_in()) { 
    wp_nav_menu( array( 'menu' => 'menu-logged-in',  'container_class'   => 'menu-header'));

else {
   wp_nav_menu( array( 'menu' => 'menu-logged-out', 'container_class' => 'menu-header' ));
add_filter( 'wp_nav_menu_args', 'my_wp_nav_menu_args' ); 

However, I get the error : " Fatal error: Allowed memory size of 100663296 bytes exhausted (tried to allocate 130968 bytes) in …/…/public_html/wp-includes/nav-menu-template.php on line 27.

So I started wondering if it is a different container_class name for the sparkling lib, beacuse the code snippet above was inteded to be used with twenty ten theme? Is the container class the same for sparkling theme?

Regards Robin

Hi Robin,

I hope you are well today and thank you for your question.

Instead of custom coding you can achieve this easily using following plugin.

Best Regards,

Thank you, and thank lord for these smart plugins!

You are most welcome here :slight_smile: