How can i display the events of child site(s) in parent site?

Home Forums Calendar Products Events Calendar PRO How can i display the events of child site(s) in parent site?

Viewing 4 posts - 1 through 4 (of 4 total)
  • Author
    Posts
  • #1012135
    Umar
    Participant

    We 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.

    #1012226
    George
    Participant

    Hey @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_blog

    Sorry about all of this, @Umar! Let us know what you think.

    β€” George

    #1012260
    Umar
    Participant

    Thank You George. Its unfortunate to hear this. But still let us explore the ways you mentioned here! πŸ™‚

    Good Day!

    #1012724
    George
    Participant

    It 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

Viewing 4 posts - 1 through 4 (of 4 total)
  • The topic ‘How can i display the events of child site(s) in parent site?’ is closed to new replies.