Tagged: , ,

Viewing 4 posts - 1 through 4 (of 4 total)
  • Author
    Posts
  • #6383

    Inspired by http://vanweerd.com/enhancing-your-wordpress-3-menus/

    I would like to add the following code to enable a “Log in” / “Log out” link but only on the Template’s sub menu.

    The code is added to the theme’s functions.php

    Q) Please can you tell me what this should be changed to or even suggest your preferred method:

    if($args->theme_location == ‘Primary’) {

    Thanks!


    function add_login_logout_link($items, $args) {

    if($args->theme_location == 'Primary') {

    ob_start();
    wp_loginout('index.php');
    $loginoutlink = ob_get_contents();
    ob_end_clean();

    $items .= '
    <li>'. $loginoutlink .'</li>
    ';

    }

    return $items;

    }

    #53951

    Hey,

    the theme location for the sub menu is “avia2″ instead of “Primary”.

    #53952

    Excellent! Thanks!!!

    Thanks also for fixing the display of the post after I added the code snippet.

    I have been building my site over the past few hours and the theme is awesome :-)

    #53953

    Glad that I could help you :)

Viewing 4 posts - 1 through 4 (of 4 total)

The topic ‘Adding a Login/Logout Menu Item’ is closed to new replies.