How do I display/pull posts from subdomains to the landing page (domain) in WordPress Multi-site?

I have 8 sites in my multi-site network:

  1. Group Landing site (domain)
  2. Group 1 site (subdomain 1)
  3. Group 2 site (subdomain 2)
  4. Group 3 site (subdomain 3)
  5. Group 4 site (subdomain 4)
  6. Group 5 site (subdomain 5)
  7. Group 6 site (subdomain 6)
  8. Group 7 site (subdomain 7)

Essentially, Groups 1 to 7 will have separate contents. However, the Group Landing site will have content from both. I would rather not have the user enter the content twice. The post must also link/point to the Group/subdomain where it was originally published.

Is there a way for me to pull content from Group 1 and Group 2, and display it in Group Landing?

(Clarification: I want to pull content. That means, that I want to be able to run a query and get information from other posts and pages and display on the front end. I am not looking to duplicate content on the back-end, or to share content on the back-end. So, if the source is deleted than nothing will show on the front-end.)

What I did: I'm not sure if I did it correctly (I don't even know how to code), but I appended the code snippet below in the functions.php of my theme:

foreach( $blog_ids as $blog_id ){
    switch_to_blog( $blog_id );
    $post = get_post( $post_id );
    restore_current_blog();
}

Reason for asking: I want to replicate this feature from the front/homepage of this website: https://www.inquirer.net. Also, the web hosting support team cannot provide snippets for this feature because they only have Python/Go developers rather than WordPress developers.

Topic post-content multisite content Wordpress

Category Web

About

Geeks Mental is a community that publishes articles and tutorials about Web, Android, Data Science, new techniques and Linux security.