The MU forums have moved to WordPress.org

Tag or function to link to main blog? (5 posts)

  1. tunghoy
    Member
    Posted 14 years ago #

    I've spent a long time searching, but with no luck, so far. How can I put a link on a sub-blog that links to the main blog? Right now, I'm hard-coding it, but would rather not.

    I've tried all kinds of things like
    `">Home'

    but nothing seems to work.

  2. Klark0
    Member
    Posted 14 years ago #

    <?php $current_site = get_current_site(); ?>
    <a href="http://<?php echo $current_site->domain . $current_site->path ?>">Home</a>

    How bout that?

  3. tunghoy
    Member
    Posted 14 years ago #

    That's excellent, thank you! I notice this includes a trailing slash, so I can append the directory name of another sub-blog to move between sub blogs. Very cool.

    Since I'm trying to learn my way around WP, can you tell me where I can find a reference to other functions like get_current_site()? When I looked at the page of template tags at http://codex.wordpress.org/Template_Tags, it wasn't listed.

  4. Klark0
    Member
    Posted 14 years ago #

  5. tunghoy
    Member
    Posted 14 years ago #

    Great! Thanks again!

About this Topic