Code Snippets is a powerful WordPress plugin that lets you easily add custom code snippets to your website without modifying your theme’s functions.php file or creating a child theme.
Here’s how to use it:
- Install and activate the Code Snippets plugin from the WordPress plugin repository.
- In your WordPress dashboard, navigate to the “Snippets” menu.
- Click the “Add New” button to create a new code snippet.
- Give your snippet a name, add your code to the “Code” box, and add a description and tags optionally.
- Choose the “Scope” of your snippet, determining where the code will be executed on your website.
- Click the “Save Changes and Activate” button to activate your new code snippet.
That’s it! With Code Snippets, you can easily add custom functionality to your WordPress website without having to modify your theme’s files.
Export and import snippets
Code Snippets also allows you to easily import and export your snippets between different WordPress websites or back up your snippets for safekeeping.
- In the WordPress control panel, go to the “Snippets” menu.
- Click on “Export” next to the selected snippet. If you need to select multiple snippets, check the boxes next to the snippet name and select “Export” in the dropdown box.
- The file will be saved directly to your computer.
- In the WordPress control panel, go to the “Snippets” menu and the “Import” submenu.
- Select the file you want to import and click the “Upload files and import ” button.
That’s it! With Code Snippets, you can easily import and export your custom code snippets between different WordPress websites or backup your snippets for safekeeping.