Forum Replies Created
-
AuthorPosts
-
January 30, 2019 at 9:58 pm in reply to: Get content from another site in the network, Rest API? #87113
Marky
ParticipantHey Zac, I’m having a little issue with that ajax call… I’m not sure how to piece it together within this gutenberg/react context. If you’ve got a quick pointer that’d be great.
Thanks mate,
Mark
January 28, 2019 at 9:52 am in reply to: Get content from another site in the network, Rest API? #86473Marky
ParticipantAhh, spoke too soon… it’s not showing up in the editor.
this block has encountered an error and cannot be previewed
And it looks like it’s a bit more of a legacy approach. Gah…
January 28, 2019 at 9:47 am in reply to: Get content from another site in the network, Rest API? #86470Marky
ParticipantSorted it!
So you can use the ServerSideRender wp component. That looks for the blocks related php file and pulls the output from there into the attributes. Amazing. Thanks for setting me on the right path!
edit( { className, attributes, setAttributes } ) { return ( <Fragment> <ServerSideRender block="ccsblocks/dynamic-factsheet" attributes={ { stuff: attributes.stuff } } /> </Fragment> );
January 28, 2019 at 8:58 am in reply to: Get content from another site in the network, Rest API? #86457Marky
ParticipantThanks for getting back to me Zac!
To clarify, there’s three sites in my network. There’s some content that’s global to all sites so I’ve picked one of the sites to be the ‘parent’ site where this global content is administered. In this case a post type called ‘factsheets’.
So the requirement is to pull this content from the parent site and into the two other sites. The block is used across the entire Network.
I’m totally new to React but have done plenty of ajax stuff before, I’ll look into it, but if you’ve a quick basic example to hand that would be great. I’m not part of the WP Slack group but should be able to find if withSelect can handle Multisite.
Thanks again!
-
AuthorPosts