What I would do is to use switch_to_blog function just before posts queries are run on the database, and then restore the current blog just after the query.
I assume that the blog where your content is is the main one (1). Just put the following lines in your second blog theme’s function.php :
add_action('pre_get_posts', 'user16975_get_content_from_other_blog');
function user16975_get_content_from_other_blog(){
switch_to_blog(1);
}
add_filter('the_posts', 'user16975_restore_initial_blog');
function user16975_restore_initial_blog($posts){
restore_current_blog();
return $posts;
}
This should work for both back- and front-ends.
Be careful to test this fully before using, because it could have unintended behaviors. For example, all the settings used for the second blog are taken from the second blog database, so they might be different from the main blog.
Related Posts:
- Theme Activation, Create Database Tables
- WordPress Backup
- I want to run different WordPress websites under the same database
- Delete database tables on theme uninstall?
- Should a child theme share the same theme options row as the parent, or should it have it’s own options row?
- Are theme .php files stored in the database?
- Posts and Pages not showing on admin, but showing in theme
- 1 Database for multiple WordPress themes
- How to transform a custom made static HTML website to a WordPress website [closed]
- Using the same database on another Subdomain
- different theme in one website
- I’ve got a theme I can’t update and won’t let go
- Trying to revive an old wordpress site, but newer versions of wordpress install a different db structure
- Switching among theme customizations
- The function is deprecated; use mysql_real_escape_string() instead
- Uploaded WordPress theme not finding pages and css
- WordPress Theme Migration Local to Live Assets Not Loading
- How to change images size after theme modification?
- How to change database entries due to theme change
- Using OOP in themes
- How can I allow the Editor Role to change Theme Settings?
- How to Link External jQuery/Javascript files with WordPress
- Am I allowed to license my WordPress theme under the aGPL
- Best way to include Bootstrap in WordPress
- Undefined offset: 0 in > […] /wp-includes/capabilities.php on line 1067
- Best practices for a Style/CSS based theme options page?
- How to license my commercial WordPress theme? [closed]
- How to Use WordPress as Static CMS Without Blog Posts
- How do I create my own admin button and theme settings page?
- Editing Links in the Footer of WordPress Themes with Base64 Encrypted Code?
- How to set two different themes on one WordPress? (Desktop vs. Mobile)
- How can I add a set featured image function to a theme that doesn’t already have it built in?
- Jquery in Child Theme
- Changing the visible url path to css & js files
- Display custom_background outside wp_head()
- How to automatically highlight syntax of code in a post?
- register_theme_directory and broken deploys
- Retaining old HTML archives and displaying themes conditionally
- switch a theme different per user role
- Extra User Profile Field Upload File / Image
- How to make alert for new version on theme options?
- Can we create a child theme for a premium child theme built on Genesis framework?
- WordPress ignoring specified template for front page. Why?
- Migrating October CMS to WordPress
- Alternate header image
- Change logo on each page of University Hub theme [closed]
- Why are my sidebars not registering in unit tests
- How do you manage your theme versions when privately distributing?
- wordpress themes demo file importing problem? [closed]
- How to run word press theme on localhost in Ubuntu OS?
- get_template_directory has an odd functionality
- Theme editor not showing correct index.php
- How to start learning CSS and theme development?
- How do I make the category template display full posts instead of partial posts?
- Does uninstalling a WordPress theme delete its database values?
- Confit theme on WordPress.org
- How to set different settings for a mobile theme?
- How to set a single theme directory on a multisite blog?
- PHP Parse error: syntax error, unexpected end of file, expecting elseif (T_ELSEIF) or else (T_ELSE) or endif (T_ENDIF) on line 230 [closed]
- Child theme not using parent theme css/styles/formatting?
- Problem after renaming wordpress template file
- 100% width Featured Image Size
- What’s the proper way to include inlined javascript-source?
- Make it possible to pick a color theme for specific pages
- Create register form without a plugin
- Retina JS not working
- Get WordPress to use another custom “author.php” file (“custom-author-file.php”)
- wp_add_inline_style() not working?
- X-Axis of Site is Messed Up Because it is in Hebrew
- How can I use a logo in the header?
- How to create my own sidebar in Twenty Eleven child theme?
- How to find out if page_for_posts is showing (in order to style menu item)
- JavaScript Files Registered in Parent Theme Won’t Load When Calling wp_enqueue_script() in Child Theme?
- WP can’t create new directory
- How can I manually activate my previous theme without browser access to dashboard?
- Can “Classic Editor” plugin help to replicate the old website / theme development experience from c. 2011?
- Creating custom meta box throws PHP warning error in WordPress
- What is the point of needing add_theme_support( ‘html5’) in WordPress 5.x
- Plugin and themes are adding the same stylesheets
- WordPress EduPress and businessbite Theme Installation Failed [closed]
- understanding theme hierarchy
- Posts as filtered list – expandable
- Jquery Theme Roller to WordPress
- Implementation of language_attributes function
- Setting Multiple Post Containers Across Homepage And Costumize Them
- Own Theme custom CSS does not display in editor but works in page
- Remove Read More Buttons
- CSS/JS is not working in multi lang installation
- Error while downloading WordPress themes
- Work on theme files on a server & browser preview before installing it
- div having different appearances in different themes
- Satoshi WordPress Theme – Portfolio SetUp Issues
- How to make a website like the ones in theme demos? [closed]
- theme 2016 – customize css – nothing happens
- Can’t upload the theme
- Divi theme including javascript
- Setting colors in theme.json changes default font size and family in backend
- What’s the best way to go from a design to a customized WordPress site?
- Alternative to Underscore.me for gen custom blank theme [closed]
- Every newly created page links to the same deleted page