As there have been a few posts where questions around this came up, I thought it may be useful to show the four most common ways you can add custom code that work well with Cwicly.
1. Child theme functions.php
- Download the child theme and install from here (only do this for new websites unless you know how to transfer your theme customisations to the child theme):
Cwicly.com dashboard - Add child theme & make links obvious - #9 by StrangeTech
- Edit the functions.php file and add your custom code
2. Cwicly custom code
Go to Cwicly Settings
Add your custom code in the Custom Code area
3. Code Snippets plugin
- Install and activate the Code Snippets plugin
- Add a new snippet
- Add your custom code to it
4. Cwicly Code block (in post, page or template)
- Ensure you enable the use of code blocks in the Role editor as per the Cwicly documentation
- Add a code block to the post, page or template you want it to be used on
- With the code block selected, insert your code into the appropriate field in the inspector panel
Depending on your requirements and ways of working, one method may be preferred.
For example, some developers may use the Code Snippets plugin on all of their sites and so the quick import and export may become useful.
On the other hand, if keeping the number of plugins to a minimum is a priority, then using the built-in Cwicly methods maybe preferred.
The key factor is to ensure the code is available for the context you want to use it. If it is only going to be used on a single page, then using a code block on that page may be a good approach. If the code must be available on all pages, then either placing it within a globally used page template or using the code snippets / custom code / child theme functions.php become the applicable choices
Hopefully this will help those of you learning how best to use Cwicly more easily use custom code on your websites.