I have created a page on one of our sites which has a few snippets of custom CSS to make it display in a very modern, 100% width style like this, as opposed to the standard, more constrained style of pages the site's theme allows.
This style of page, however, is not going to be used site-wide, so getting a new theme or editing the existing theme's child isn't really an option.
What I'd instead like to do is create a simple plugin that will add a checkbox to the edit page that, when checked, will load this custom CSS on the page in question. I know roughly how to set a plugin up, but how would I write it to;
- Add a checkbox to the edit page?
- If the checkbox is ticked, load the custom CSS?
While I could just add this custom CSS to each page manually, creating a plugin would mean transporting the code around from site to site will be much easier, and also mean that the risk of overwriting and losing it would be minimized.