Resolved using this code:
global $switched;
switch_to_blog(1);
//get_header();
$root = realpath($_SERVER["DOCUMENT_ROOT"]);
include ($root.'/wp-content/themes/themename/header.php');
restore_current_blog();
global $switched;
switch_to_blog(1);
//get_footer();
$root = realpath($_SERVER["DOCUMENT_ROOT"]);
include ($root.'/wp-content/themes/themename/footer.php');
restore_current_blog();
Related Posts:
- How can I trust switch_to_blog()?
- Sharing Dynamic Sidebars across Multisite Blogs
- switch_to_blog(): Load textdomain
- Get Recent Posts by Date in Multisite
- switch_to_blog() performance considerations & alternatives
- Merging multiple wp_query objects
- latest 5 posts using switch_to_blog loop
- Strange switch_to_blog() issue
- Switch_to_blog() outside wordpress
- why when I try to insert an image attachment along with a post does wp_get_attachment_url give me a very wrong file path?
- restore_current_blog required after switch_to_blog, if I use that in a function?
- Upload images from one site to another in Multisite
- Is it a bad practice to use switch_to_blog in the frontend?
- Multisite – Get current post id
- switch_to_blog() and wp_nav_menu() not functioning properly
- switch_to_blog( ) content disappears after load
- What is the way to share data between sites in a multisite
- get post id by $content (so by post content)
- Using wp_enqueue_media() with switch_to_blog() issue
- Register submenu on network menu from the subsite
- Make a list of sites for each user in WPMU – switch_to_blog (display in SITE_ID: 1)
- Multisite wp_query & switch_to_blog issue
- the_post() within switch_to_blog() altering my excerpt
- Include Site 1 Posts in Query for Sub Sites
- switch_to_blog() for parent theme
- get_term_by works but get_terms doesn’t?
- Sort posts according to date
- Multisite switch to blog
- Best Practise: Linking to WPMU sites from other sites
- Bug using wp_insert_term with switch_to_blog
- Trouble with SQL SELECT inside switch_to_blog()
- Not able to retrieve image id from sibling site within a switch_to_blog
- switch_to_blog() + do_action(‘generate_footer’) not working in multisite
- How to get tags from different blog?
- Display posts from one network site on another
- Get variable from previous blog while using switch_to_blog
- switch_to_blog($blog_id); still writing to main blog
- fatal Error undefined function switch_to_blog()
- How to get all pages on specific blog after switch_to_blog?
- Get_posts not returning any posts when used with switch_to_blog
- Do “switch_to_blog()” and “restore_current_blog()” re-run the filters?
- Access from template info of another blog (in the same network)
- Get the excerpt by page ID from another blog in a wordpress multisite?
- Best Way to Inventory the Media Library of a 200+ Multisite Installation?
- How do I use a combination of switch_to_blog() and wc_create_order()?
- WordPress Multisite Network Shared Custom Post from Main Site using single-CPT.php
- Multisite, using switch_to_blog in filter
- Memory growth with new additions to WordPress Multisite