Forum Replies Created

Viewing 4 posts - 1 through 4 (of 4 total)
  • Author
    Posts
  • in reply to: Get content from another site in the network, Rest API? #87113
    Marky
    Participant

    Hey 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

    in reply to: Get content from another site in the network, Rest API? #86473
    Marky
    Participant

    Ahh, 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…

    in reply to: Get content from another site in the network, Rest API? #86470
    Marky
    Participant

    Sorted 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>
                );
    in reply to: Get content from another site in the network, Rest API? #86457
    Marky
    Participant

    Thanks 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!

Viewing 4 posts - 1 through 4 (of 4 total)