The MU forums have moved to WordPress.org

Template tag - site_url? (7 posts)

  1. ceejayoz
    Member
    Posted 17 years ago #

    I'm adding in a "Hosted by..." bit in the Tarski footer for WPMU users, and I'm running into a missing tag.

    I can use get_site_option('site_name') to get the overall site name (not the individual blog, but the hosting WPMU install), but there's no eqivalent site_url one.

    What's the best way of doing this? I'd rather not query the database to see what the first blog's URL is...

  2. mysorehead
    Member
    Posted 17 years ago #

    I just made my own template tag as a plugin with the site name and url hard coded. Can use it anywhere.

    Richard

  3. drmike
    Member
    Posted 17 years ago #

    We discuss this a few weeks ago. Take a look at the two default themes in their footers as I believe Donncha did an example of this.

    (Can't pull up an additional window here so I can't check)

  4. ceejayoz
    Member
    Posted 17 years ago #

    I can't believe I didn't think to check that, drmike - thanks!.

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

    Works like a charm.

  5. Yooakim
    Member
    Posted 16 years ago #

    For some reason this doesn't work for me. I have a subdomain setup.

    When I use this "$current_site->path " All I get is the topdomain. not the subdomains...

    Any suggestions why this happens?

    Cheers,
    joakim

  6. drmike
    Member
    Posted 16 years ago #

    This thread is discussing the top level domain, not the individual subdomains. Get_current_site pulls the master site.

    You want get_option('blogurl') I believe. Someone check that for me please.

  7. lunabyte
    Member
    Posted 16 years ago #

    <a href="<?php bloginfo('home'); ?>" title="<?php bloginfo('name'); ?>"><?php bloginfo('name'); ?></a>

    or:

    bloginfo('url')

    works as well.

About this Topic

  • Started 17 years ago by ceejayoz
  • Latest reply from lunabyte