This is a first stab at a Wordpress plugin to reproduce content from http://gov.uk on any Wordpress post or page.
It provide a new shortcode
[govuk url="https://www.gov.uk/<content page>"]
which causes the content of that page to be inserted into the current post/page. The content is adjusted such that any href or action attributes are pointed to the current page rather than at the gov.uk site. Any form data posted is proxied through to gov.uk.
This makes it possible to embed the very nice form based content from gov.uk (such as https://www.gov.uk/maternity-benefits) to be embedded in a Wordpress post. This may be useful for any Local Authorities who use Wordpress to reuse things like https://www.gov.uk/housing-benefit or https://www.gov.uk/after-a-death/overview
The plugin is pretty rough and I make no great claims about my (very rusty) coding skills, but you are welcome to take it, use it, improve it, as you will.
Download the current master from GitHub
You’ll probably want to rename the folder when you unzip it into your /wp-content/plugins/ folder.
If you want to improve the plugin in anyway, I’ve just put it on GitHub https://github.com/saulcozens/wordpress-gov.uk, so please hack away. There is plenty of room for improvement. This is still to do:
provide an option to pull the stylesheet in too - the gov.uk stylesheets are so very lovely - do something about the location lookup (completely missed that functionality) - replace the dodgy hacky way I add .json to the request URL - add in the proper attribution and government open license link (bad me!) - probably add some error checking - test it a bit better
- simplehtmldom - a copy is included with the plugin
- @jystewart for his API work on gov.uk
- the entire gov.uk team for general awesomeness