WordPress.org

Ready to get started?Download WordPress

Forums

Adding new toolbar item / path to page? (5 posts)

  1. speedyp
    Member
    Posted 2 years ago #

    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?

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

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

  3. speedyp
    Member
    Posted 2 years ago #

    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

  4. 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 :)

  5. speedyp
    Member
    Posted 2 years ago #

    Sounds encouraging - thanks :)

Topic Closed

This topic has been closed to new replies.

About this Topic

Tags

No tags yet.