Home › Forums › Calendar Products › Events Calendar PRO › How can i display the events of child site(s) in parent site?
- This topic has 3 replies, 2 voices, and was last updated 10 years, 7 months ago by
George.
-
AuthorPosts
-
October 6, 2015 at 11:12 pm #1012135
Umar
ParticipantWe just purchased the PRO plugin (Multisite).
We have couple of questions regarding the multisite integration.
1. In parent site we need to show all (parent and child) events in calendar page.
2. In parent site we need to show all (parent and child) recent event list. Somewhere in the sidebar.In this way the users can able to see all events across from all site in parent site.
October 7, 2015 at 6:25 am #1012226George
ParticipantHey @Umar,
Thanks for reaching out! And for buying that license π One thing to note about this license, however, is that it is “Multisite” because it allows you to register the plugin for a multisite network with an undefined number of sites on the network. However, it does not mean that this edition of the plugin has any special multisite-specific features or anything like that.
So, unfortunately, there aren’t any built-in ways to do the things you are trying to do here π Even worse, there’s no simple way to do this at all even with custom code! This is because WordPress’ WP_Query class does not allow you to query in a special way across multisite networks. Check out this WordPress Core development ticket, which someone made when trying to make this a feature β https://core.trac.wordpress.org/ticket/22816
It was closed by a Core WP Developer who left this note as to why they are cancelling the proposed idea there:

So for the time being, doing #1 and #2 as you requested would require some extensive and clever code customization to work. We do not offer support for custom code here to begin with, but also even if we did this customization would be quite specific to your site and hard for us to be able to offer much insight on.
One possible solution is to use the function switch_to_blog() β essentially, you’d run one query for events on the current site (parent or child, whichever you’re currently on). Then you’d “switch to blog” with that function to the ID of the other blog you want to pull fromΒ βΒ then run another events query. Then repeat this for all sites you want to query from, and at the end of it all use the function restore_current_blog() to make sure you stay on the current blog for other code to run.
Check out these functions here for more info:
https://codex.wordpress.org/Function_Reference/switch_to_blog
https://codex.wordpress.org/Function_Reference/restore_current_blogSorry about all of this, @Umar! Let us know what you think.
β George
October 7, 2015 at 6:48 am #1012260Umar
ParticipantThank You George. Its unfortunate to hear this. But still let us explore the ways you mentioned here! π
Good Day!
October 8, 2015 at 8:07 am #1012724George
ParticipantIt is indeed unfortunate π Thanks for being cool despite the bad news βΒ I will close up this thread for now but if other questions/comments/concerns ever arise, open a new thread any time!
Best of luck with your project,
George -
AuthorPosts
- The topic ‘How can i display the events of child site(s) in parent site?’ is closed to new replies.
