Skip to:

"Switch_to_blog" for all of those global header and sidebar needs…

  • jodyw1


    While some people are letting their members do any style, any way on their own personal MU blog pages, I wanted a more uniform appearance, at least at first, for my site.

    I’d seen others ask the same or similar questions about creating what would be a “global” header and sidebar functions that could then be used on the member pages. But I’d never saw an easy way to do this until today.

    The switch_to_blog function.

    I had no idea there was such a thing — mainly ’cause I’m still learning WP — but it’s been a pot of sweet, succulent goodness now that I’ve discovered it and how it works.

    I’ve been able to use it to create a consistent header across all of the member blogs. I’m working now on creating the recurring sidebar I wanted by using that and the restore command.

    I’m sure there are some limitations, but I’m not attempting anything too fancy with this. So if you are working at trying to get some kind of scripted action controlled from afar for your member pages, check out the


    We now return you to your regularly scheduled Forum conversation, already in progress.

Viewing 4 replies - 1 through 4 (of 4 total)

  • r-a-y


    Yes! The switch_to_blog() function is so important!

    That’s one of the first “eureka” moments I had when switching over from WordPress Standard to MU.

    Andy Peatling


    Use this function sparingly as it is slow.



    Thanks, Andy. I’ve noticed that. My next trick will be figuring out how to optimize everything.

    I’m kidding. My next trick will be paying someone to figure out how to optimize everything.



    well another option you may have is “Sitewide tags” i have used it in one of my sites for pulling all blog posts in content area having global header,footer and sidebar.


Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘"Switch_to_blog" for all of those global header and sidebar needs…’ is closed to new replies.
Skip to toolbar