Support » Networking WordPress » Adding new toolbar item / path to page?

  • Trying to create a template site for my new multisite.

    I want to add a new top tool bar item to my multisites which takes the logged-in user to a custom help page on their subsite.

    I’ve found some code to add to functions.php which creates the new item, but the link is written as the full http path:

    function wp_admin_bar_new_item() {
    global $wp_admin_bar;
    $wp_admin_bar->add_menu(array(
    'id' => 'wp-admin-bar-new-item',
    'title' => __('iShift Archive'),
    'href' => 'http://www.instantshift.com/archive/'
    ));
    }
    add_action('wp_before_admin_bar_render', 'wp_admin_bar_new_item');

    How can I replace “http://www.etc” with a link to the subsite help page, without having to re-write the functions.php for every subsite I add?

Viewing 4 replies - 1 through 4 (of 4 total)
  • Moderator Ipstenu (Mika Epstein)

    (@ipstenu)

    Lead Plugin Wrangler

    You mean this URL? http://www.instantshift.com/archive/

    What do you want it to be? /archive/ ?

    Sorry Mika – just left the original code I found on the web.

    I’m trying to create a template site for new subsites. I want to include a special welcome page with help and advice. What I’m trying to do is edit the top toolbar which will take them to a help page which I will have added to their own site (hidden from main menu).

    It would be easy if I just link them back to a page on my homesite, but I was trying to avoid them leaving their own subsite if they don’t have to?

    Cheers

    Moderator Ipstenu (Mika Epstein)

    (@ipstenu)

    Lead Plugin Wrangler

    Right 🙂 If the page is the same URL on every site (like site.com/archives/) we can work with that 😉 Gotta know the pattern, and then we can grab site_url and all that fun stuff 🙂

    Sounds encouraging – thanks 🙂

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘Adding new toolbar item / path to page?’ is closed to new replies.