The MU forums have moved to WordPress.org

Displaying The Main Site Permalink (2 posts)

  1. moonviper
    Member
    Posted 15 years ago #

    I'm attempting to create a theme for WordPress MU that, for simplicity's sake needs to contain some links to the main home page for the site.

    I wish to do this in a dynamic manner so, for instance, I could pull the logo from the main Blog, and not need to duplicate it within the theme.

    What I've got so far is:

    "><?php bp_site_name() ?>

    Which would display as:

    Site Name

    on the main blog, but displays as:

    Site Name

    on example.domain.com.

    Is there a way (other than hard coding the main blog's URL into the theme itself) where I could alter that original code and display the main blogs url (http://domain.com) on the subdomains?

  2. grandslambert
    Member
    Posted 15 years ago #

    You might try using the function

    <?php switch_to_blog(1); ?>

    before calling the

    <?php bp_site_name(); ?>

    which should give you the correct link.

    Don't forget to call

    <?php restore_current_blog(); ?>

    after displaying the link so the rest of the pages uses the correct blog.

About this Topic

  • Started 15 years ago by moonviper
  • Latest reply from grandslambert