0

I've built and manage two primary/junior school sites in the UK. They've recently come together under a Multi Academy Trust (MAT) and consequently, they now share a fair amount of common policies and documentation.

Currently an admin at each school is provided the latest document version (via email) to upload and link to on their respective sites, so there is already some duplication of effort and potential for version control becoming out of sync.

I'm now developing a third site, for the MAT itself. Moving forward we'd like to host the shared and common policies only on the MAT site and have the two schools link through to the relevant documents on the MAT site. That way the MAT site is solely responsible for providing the latest version of a policy document.

However, to keep things up to date and in sync between the three sites, it still requires some notification down from the MAT to the two schools to let them know there is a new version of a document and to update the link accordingly.

This will be an improvement but is still a bit of a pain and I'm looking for a smarter solution, whereby each school site links to a permanent location (a directory?) at the MAT site and simply links to the file that is in that directory. In this way the 2 school sites would not need to update their policy links once they have been established. This is not possible using the WP Media Library 'out of the box' (especially when we are using permalinks with a structure domain.co.uk/%year%/%monthnum%/%postname%/ ) as the month/year will change on the MAT site when they upload a revised policy version.

I'm sure this is not such a niche request and that others will have faced a similar issue. I've been looking at the MAT site utilising a 3rd party document management system, such as Zoho Docs, Google Docs, DropBox Pro or similar, and avoiding the WP Media Library altogether.

I'd be interested to hear other users experience and solutions for this type of scenario and if it can indeed be achieved with Wordpress alone, or maybe a plugin solution?

0

There is nothing in WP that specifically deals with cross–site communication. Every WP site is an island by design.

However there are plenty helpful bits and pieces to rig suitable solutions for many use cases.

As far as I follow your case I would imagine something like this:

  1. Central sites hosts documents (in whatever way is convenient for you).
  2. Central site publishes machine–readable (JSON for example) registry of documents with their links. Implementation could be as special template or whatever, many ways to do it.
  3. School sites pull registry (HTTP API), cache it (Transients API), and display.

Building blocks are (relatively) basic, but this will ensure that central site is in control and linking sites are up to date and don’t rely on humans to keep up with the documents and links.

  • Appreciate answer, but that's a little bit over my head and I was hoping to resolve without outsourcing to a developer! Answer below option 1 & 3 seem more suitable for this client. Thanks. – Dozza Jun 26 '18 at 14:02
0

Option 1: content within content

One option is creating a WordPress Page (or Post or CPT) for each document. So in addition to uploading the PDF to the MAT site, you would also create a Page that links to the PDF. That way, when you first publish content on the MAT, you send the Page's URL to the two schools. Then regardless of how many times the end PDF is updated, you'll just edit the MAT Page link, and the schools won't have to make any changes.

Option 2: redirects

Another option is redirecting. You'll still upload the PDF just one time, to the MAT, and then either by using a plugin or by editing .htacess, you'll add redirects. For example:

Redirect 302 /name-of-the-document http://mysite.edu/wp-content/uploads/05/filename-current-version.pdf

You'll use 302 (temporary) redirects because if you use 301s, web browsers will cache the redirect, and they'll point to the old version of the PDF until the visitor clears their cache. By using 302s, visitors will be taken to the new version whenever you upload a new file and update your redirect to point to it. Simply give the shortened /name-of-the-document URL to your schools to link to.

Option 3: preserve filenames

This can be a bit tricky, but you can also simply upload the PDFs to the MAT site, then whenever there's an update, delete the old PDF and upload a new PDF with exactly the same filename.

The trickiness is, you'll need to have one Page (or Post or CPT) where you upload these. If you upload directly to the Media Library, then WordPress will automatically put it in the current month's folder every time you upload a PDF, so then the URL changes. But if instead you go to an editor view of the same Page every time, WordPress automatically puts uploads that you upload in that screen into the Page's originally-published-date folder. So even if you don't actually include the PDF within the Page, as long as you always (1) delete the old PDF first through the Media modal and (2) upload the new PDF with the exact same filename through the Media modal, your schools won't need to update their links because the new file is at the old file's URL.

The downside is, if you have non-technical users uploading or simply aren't super careful about deleting and uploading in the right place, it's easy to accidentally put the file in the wrong folder or have the filename off by a character, and then the schools will have broken links. Also, if visitors have the PDF cached, they may see the old PDF rather than the new updated one (though that would also be a problem if they printed out a hard copy, so you can't always prevent people from using an old copy anyway).

  • 1
    Option 3 can be done by using a plugin such as replace media this allows to change an image or PDF by simply replacing the document keeping the URL the down side is that you wound need to re upload the old version as you would be replacing it on the server with new but URL link would be constant. Alternatively a plugin that lets you upload to a created folder on the server where you upload to like this plugin en-gb.wordpress.org/plugins/custom-upload-dir – Sam May 22 '17 at 20:00
  • @webelaine I can't be getting the client to implement htaccess redirects unfortunately but I like the sound of options 1 & 3. Appreciate you clarifying the behaviour of media upload through page as opposed to direct to library - I'd noticed that before but never quite known for sure. – Dozza Jun 26 '18 at 14:13
  • @Sam thanks for the plugin suggestion. I'll look for something simiar as that one is quiet outdated.... – Dozza Jun 26 '18 at 14:14

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.