WordPress.org

Forums

Elisium
alternate menu for logged in users (5 posts)

  1. donohuge
    Member
    Posted 1 year ago #

    Could someone tell me what code to use so generate a different menu for logged in users?

    I've tried all the stuff on google but it either doesn't work or it bricks my site.

  2. We Create Web Designs
    Member
    Theme Author

    Posted 1 year ago #

    Haven't tried this, but maybe it's something like:

    <?php
    if ( is_user_logged_in() ) {
    echo 'HERE YOU PLACE ONE MENU FOR THE LOGGED IN USERS';
    } else {
    echo 'ANOTHER MENU FOR THE OTHERS';
    }
    ?>

  3. donohuge
    Member
    Posted 1 year ago #

    so should I put it in functions or header?

  4. We Create Web Designs
    Member
    Theme Author

    Posted 1 year ago #

    You place the code where you want it to appear

  5. alchymyth
    Forum Moderator
    Posted 1 year ago #

    possibly in header.php to replace the line with the existing menu code;

    <?php wp_nav_menu( array( 'theme_location' => 'secondary', 'menu_class' => 'nav-menu' ) ); ?>

    review the Codex chapter http://codex.wordpress.org/Function_Reference/wp_nav_menu#Different_menus_for_logged-in_users

    http://codex.wordpress.org/Function_Reference/wp_nav_menu

Topic Closed

This topic has been closed to new replies.

About this Theme

About this Topic

Tags

No tags yet.