Take the 2-minute tour ×
WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

all. Just trying out switch_to_blog() as a way to have a child site get some news items from the parent site. Problem is, the parent site--first tables in database--doesn't have a number, i.e., tables are like www_posts--there's no number to put in the parentheses, 0 doesn't work, empty doesn't work.

How can I reference this original install? Also, is it no longer cool to use switch_to_blog()?

Thanks!

share|improve this question
add comment

2 Answers

up vote 1 down vote accepted

switch_to_blog(1); to switch to the root (primary) blog and pull post info.

restore_current_blog(); to switch back.

share|improve this answer
    
You'd think I would have tried that. Thanks. –  AGD Jul 25 '12 at 13:59
add comment

Another option would be to use site transients store the news items. That way it would be accessible from all network sites and you wouldn't have to call switch_to_blog to access them as I believe it is quite server intensive.

Transients API

And the specific function you would want to use for network access would be:

set_site_transient('recentnews', 'yournewsoutputhere', expiretime);

<?php echo get_site_transient('recentnews'); ?>
share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.