Forums

Calling the blog ID (4 posts)

  1. dpetty
    Member
    Posted 3 months ago #

    I'm running 61 blogs with MU, and I'm trying to be able to call the ID of a specific blog to serve up different header images. I'm limited in my PHP knowledge, and I've tried using the codex to no avail. For example (and I know this doesn't actually work, because the_blog_ID doesn't exist) -- I would put this at the top of my index.php file:

    <div class="blog<?php the_blog_ID(); ?>">
            This is the header.
    </div>

    So, if I'm on blog with ID 16, I have a class in my stylesheet with this:

    .blog16 {
          background-image: url(http://...);
    }

    And when a user is viewing blog 16, the unique image is displayed. If the user is viewing blog 24, a different image is displayed. I would have 61 different styles in the stylesheet, each with a different image.

    Any help getting something to spit back the unique blog ID, depending on the blog a user is visiting, would be greatly appreciated!

  2. andrea_r
    Member
    Posted 3 months ago #

    Have you thought of adding the custom header option to the theme itself, and uploading the right header to each blog?

  3. dpetty
    Member
    Posted 3 months ago #

    Thanks for the reply, andrea_r!

    I found instructions for enabling the custom header in theme options (on another Web site, I think written by you?). They were very easy to follow, and it all worked!

    Link: http://wpmututorials.com/how-to/giving-your-users-changeable-custom-headers/

    One question: Right now, the custom image appears at the very top of the header, underneath a banner advertisement at the very top. How do I control where the image appears in header.php? Using div tags in header.php? And if so, how would I do that?

  4. andrea_r
    Member
    Posted 3 months ago #

    Yeah, I wrote that too. :)

    You'll have to read through the header.php of the theme, as well as the style.css.

    http://codex.wordpress.org/Designing_Headers

Reply

You must log in to post.

About this Topic