• Resolved xrun

    (@xrun)


    Hi.
    I need to determine if the current blog in a network subdomain installation is the main blog, and do one thing if it is, and another if it isn’t.

    What I have so far is this:

    <?php $blogid = $wpdb->get_blog_prefix(BLOG_ID_CURRENT_SITE); ?>
    <?php if $blogid="1" { run some code } else {run some other code}; ?>
    <?php endif; ?>

    I know this won’t work cause this isn’t valid code, but just an outline of the idea of what I need. Is there a kind and helpful coder out there that would like to lend a hand with this? 🙂

Viewing 1 replies (of 1 total)
  • Thread Starter xrun

    (@xrun)

    Solved like this:

    <?php global $blog_id;
    if ($blog_id == 1) { /* Blog description for main blog */ ?>
    <a href="<?php bloginfo( 'url' ); ?>" title="<?php bloginfo( 'name' ); ?>"><?php bloginfo( 'description' ); ?></a>
    <?php } else { /* Blog name for other blogs */ ?>
    <a href="<?php bloginfo( 'url' ); ?>" title="<?php bloginfo( 'name' ); ?>"><?php bloginfo( 'name' ); ?></a>
    <?php } ; ?>

Viewing 1 replies (of 1 total)
  • The topic ‘Determine if is main blog’ is closed to new replies.