What are these issue you’re runnng into? then we can suggest a better workaround, because you can already snag it by blog ID then post id.
They are stored as blog ID in the db. site_id refers to the entire network internally.
Andrea, you said the posts are stored as blog ID in the db. Is there a easy way to replace that variable from the main loop to prevent all the mess below?
I’d like to get the page with the same name, but from the main site.
I’m very close now.
- I’m creating empty pages in each sub-site, replicating the names from the pages in the main site, where the real content is.
- I’ve created a conditional function listing the pages to pull the content from the main site in function.php, to return true if it’s one of them (remember, I have to make changes to fewer places, so if it’s on functions or theme will be faster than assigning a value anywhere in each site’s options)
- based in that conditional, I have created a function to switch to the main site and pull the content from there, based on original query’s page name.
- I’m using post snippets to define replacement variables for each site, like CityName, BranchName, etc.
So, I’m wondering whether there’s an existing function already capable to select the site where to call the page from, using the name, instead of the id. (ID numbers across sites will be mostly different for the same-name page)
Perfect would be something like the_mainsite_content() or other “tuned” template tags to get the content from the main site instead.
Actually, a “clone this page to the rest of the sites” option would be more perfect, and I wouldn’t have to create empty pages in first place, switching them on and off just by excluding them from the sub-site menus (if they ever appear select-able for the menus)