Skip to:
Content
Pages
Categories
Search
Top
Bottom

Modify text in admin bar


  • lucasan37
    Participant

    @lucasan37

    Hi, I’m trying to modify the text of admin bar links, but in “bp-core-adminbar.php” is not what I’m looking for.

    I’ll try to explain better; the admin bar has default links, I want to change those link’s texts but I can’t find it; in “bp-core-adminbar.php” is a foreach to print the nav sub items, but I can’t find that ($bp->bp_nav) and it’s text.

    Thanks!

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

  • dpolant
    Participant

    @dpolant

    The admin bar links are generated in the component files, like bp-groups.php, bp-wire.php, etc. Here’s how you can set the text of these links without altering the core files.

    function change_text(){
    global $bp;
    $bp->bp_nav[activity]['name'] = 'test'
    }
    add_action('wp', 'change_text');

    This sets the text of the activity link to ‘test.’ If you just want to change the name of another link, use this same function and replace ‘activity’ with the slug of the component link you want to change.

    To set other text in the nav, do a print_r on $bp->bp_nav, navigate the array and set your value. You can change link urls, position, and other things as well.

    Remember, you have to add this code to a plugin or your custom.php.

    Very handy to know. Thanks :)


    lucasan37
    Participant

    @lucasan37

    Thank you dpolant, that’s what I was looking for.


    borellidesigns
    Member

    @borellidesigns

    Very handy code! I cannot seem to change the word ‘Blogs’ using this code though. I’ve tested it for ‘Activity’ and it works fine, but trying to use the following code just adds another list item to the navigation:
    function change_text() {
    global $bp;
    $bp->bp_nav[blogs] = ‘test’;
    }
    add_action(‘wp’, ‘change_text’);

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘Modify text in admin bar’ is closed to new replies.
Skip to toolbar