Overriding PinkDocs templates in your theme
If settings, blocks and custom CSS aren't enough, override PinkDocs templates in your theme to change the HTML of your help centre pages. This article is for developers comfortable editing PHP files.
How overrides work
PinkDocs looks for a template in your theme before using its own. If your theme contains a file with the same name in a pinkdocs folder, PinkDocs uses your version instead.
Override a template
Find the template
Open wp-content/plugins/pinkdocs/templates/ and find the template for the page you want to change, such as the single doc or category template.
Create the override folder
In your child theme, create a folder called pinkdocs.
Copy the template
Copy the template file into your child theme's pinkdocs folder. Keep the same file name and any sub-folder structure.
Edit your copy
Make your changes in the copied file only. Never edit the files inside the plugin folder.
Test your changes
Open the matching page on your site and check that it displays correctly on desktop and mobile.
Example: add a notice above every doc
Keep overrides up to date
PinkDocs templates can change between versions. After each update:
Read the changelog
Check the PinkDocs changelog for template changes.
Compare your copies
Compare each overridden file with the new version in the plugin's templates folder.
Merge changes
Copy any new code into your override so new features keep working.
Common questions
Check that the file is in a folder called pinkdocs in your active theme, that the file name matches exactly, and clear any caching plugin.
Delete or rename your copy in the child theme. PinkDocs goes back to its default template straight away.
