Skip to:
Content
Pages
Categories
Search
Top
Bottom

New, custom navbar

  • Avatar of Sparksdontflyup
    Sparksdontflyup
    Participant

    @sparksdontflyup

    Okay, so I’m creating a new nav menu that integrates the adminbar and the navigation links. So, I need to re arrange the slugs from:

    http://example.com/members/USERNAME/XXX

    where XXX is Wire, Activity, Blogs, ect… and USERNAME is the username of the user. To:

    http://example.com/members/XXX/USERNAME

    or

    http://example.com/XXX/USERNAME

    Anyone know if this is possible and how I would do this?

    I also need some PHP code:

    Is there a specific PHP action to call the user’s username? For example, how would I have a link like:

    <a href="<?php ' . site_url() . '/members/XXX/' . [PHP CODE TO GET USERNAME] . ' php?> ">LINK NAME</A>

    Did I make any errors? Anaways, I could use some help.

    Thanks.

Viewing 2 replies - 1 through 2 (of 2 total)
  • Avatar of Gogoplata
    gogoplata
    Participant

    @gogoplata

    There is likely a better way to do this but this should fetch the username:

    <?php

    global $current_user;

    if ( isset($current_user) ) {

    echo $current_user->user_login;

    }

    ?>

    Not sure why there’s a need to re-arrange the URL structure but hopefully that code helps.

    Avatar of Sparksdontflyup
    Sparksdontflyup
    Participant

    @sparksdontflyup

    Thanks, and the URL structure needs to be re-arranged to suit the needs of the navigation system I’m designing.

Viewing 2 replies - 1 through 2 (of 2 total)

The topic ‘New, custom navbar’ is closed to new replies.