Skip to:
Content
Pages
Categories
Search
Top
Bottom

How do I edit the Adminbar?


  • Dan
    Participant

    @4business

    Hi,

    I want to disable some of the options in the adminbar – is this possible? Mainly the social networking options, as they are currently not styled up in line with the rest of the site.

    I have already had a look at this topic that was posted on here, but to be honest that might as well be written in Japanese for the amount of sense I can make out of it.

    A foolproof how-to would be great. Thanks!

    Thanks.

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

  • James Reyes
    Participant

    @jamesreyes

    I agree. That article needs some work.

    First it says, “If you look at the code in: /bp-core/bp-core-adminbar.php you’ll see these funcitons such as bp_adminbar_blogs_menu().”

    Then it says, “We’re going to modify the ‘My Blogs’ menu without changing the core code, thus helping to assure that our modifications don’t break when upgrading.” Then gives code examples from who knows where.

    Why even tell me to “look” at a core file then tell me we are not going to modify it and then fail to tell me what file to modify?

    The article is pretty clearly written really.

    It says look at the bp-core-adminbar.php file as a point of reference, here is where the menus are constructed and clue you in to how they are added to the actual pages via the action hooks.

    If you simply wanted to remove an action as the page describes you would simply add an opposite action i.e:

    remove_action(‘bp_adminbar_menus’, ‘bp_adminbar_blogs_menu’, 6);

    Further it explains that you can now create a new function based on the existing one and is where examining the original file is useful, you can simply copy the whole function bp_adminbar_blogs_menu() paste it into a child themes function.php file rename the function slightly bp_my_adminbar_blogs_menu() make whatever modifications you want within the function then add itback into the mix via a new add_action so you remove original:

    remove_action(‘bp_adminbar_menus’, ‘bp_adminbar_blogs_menu’, 6);

    ## create new function ##
    function bp_my_adminbar_blogs_menu() {

    }
    ## add new function to admin menubar ##
    add_action(‘bp_adminbar_menus’, ‘bp_my_adminbar_blogs_menu’, 6);

    You add mods such as this to functions.php file as this way you ensure that you do not have to continually re-write them in a core file, core files should never be changed as each new BP version will replace the files and any adjustments will be lost, working in a child theme ensures these changes are preserved and continue to work after version upgrades.


    techguy
    Participant

    @crashutah

    @hnla
    That page makes quite a lot of sense once you start to understand actions and filters and how they work on WordPress. If you don’t, then it can be confusing. I’m going to add a note at the top that links to the WordPress page for Actions and Filters: https://codex.wordpress.org/Plugin_API

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘How do I edit the Adminbar?’ is closed to new replies.
Skip to toolbar