Blocks can be shared between two subsites (hereafter referred to as a “Source” and “Destination” subsite) using the UMS Post Picker plugin.  This is especially useful for consistently-updated content that needs to be displayed on multiple subsites.  By sharing the block, instead of copying from one site to another, the editor can maintain it in the Source site, and the updates will apply to all Destination sites that display the block.

Prerequisites:

  • UMS Post Picker plugin

Sharing a Block:

To share a block, it must first be created within a post, not a page.  We need to tag the post so that UMS Post Picker can find it later.  While this could be done with a page, it is much simpler to do so using a post with a tag.  Ideally, these posts will all be stored in a single subsite.

  1. Create a post in the Source subsite.  Add blocks to the page. Note: ALL content on the page will be shared.  Only add blocks/content that you want to be available on other sites.
  2. Assign a tag in the right-hand sidebar.  Use something unique.  Since UMS Post Picker will be pulling the post based on its tag, assigning the same tag to multiple posts will cause UMS Post Picker to target all of them.
  3. Publish the post.
  4. Navigate to the Destination subsite.
  5. Create a page to display your block.
  6. Add a Shortcode block to the page, modify & paste in the following shortcode:

    [ums-post-picker 
     site_id="1"
     template="full_post"
     post_type="post"
     taxonomy_terms="post_tag:{tag}"]

    Note the attributes in use:
    site_id= This is the ID of the Source subsite UMS Post Picker will search in. (ex: “1”)
    template= This is the template UMS Post Picker will use.  For blocks, always use “full_post”
    post_type= This is the post type UMS Post Picker will search for.  For blocks, always use “post”
    taxonomy_terms= Search parameter(s) that UMS Post Picker will search by.  For blocks, always use “post_tag:{tag you assigned in step 2}”.  (ex: “post_tag:usm-tuition-and-fees-block”) 

  7. Save the page.  Your block from the Source subsite should display wherever you put the Shortcode.

Important Notes

  • Shared Blocks can only be updated on the Source subsite.  When they are updated, they will be updated on the Source and Destination subsites.
  • The same shared block cannot be used twice on the same page.  WordPress sets an ID for each block.  When multiple elements with the same ID appear on a page, issues with styling occur.
    • The same type of shared block can be used on multiple pages, just not the exact same block.

Attachments: