Skip to:
Content
Pages
Categories
Search
Top
Bottom

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

  • Avatar of Jodyw1
    jodyw1
    Participant

    @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

    http://codex.wordpress.org/WPMU_Functions/switch_to_blog

    and

    http://codex.wordpress.org/WPMU_Functions/restore_current_blog

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

Viewing 4 replies - 1 through 4 (of 4 total)
  • Avatar of r-a-y
    r-a-y
    Moderator

    @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.

    Avatar of Andy Peatling
    Andy Peatling
    Keymaster

    @apeatling

    Use this function sparingly as it is slow.

    Avatar of Jodyw1
    jodyw1
    Participant

    @jodyw1

    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.

    Avatar of chouxpastry2002
    chouxpastry2002
    Participant

    @chouxpastry2002

    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.

    Regards,
    Sam.

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

You must be logged in to reply to this topic.