As a site owner, you might have come across specific customizations you need for your Paid Memberships Pro powered website. These customizations are usually found in a code recipe format from PMPro blog posts or provided by our Support Team. In this post, we will be showing you how to add code to a WordPress Membership site by using the Code Snippets Plugin.
Using the Code Snippets Add On
The Code Snippets plugin is available for free in the WordPress repository. It is an easy and simple way to implement and run PHP code snippets on your site. When using this plugin it removes the need to add custom snippets to your theme’s
10 Steps to Implement and Use the Code Snippets Add On:
- Navigate to your WordPress admin area > Add Plugin > Search, Install and activate the Code Snippets plugin.
- On the left-hand side of your WordPress admin area, look for Snippets, click on “Add New”.
- Under the “Add New Snippet” box, type in a title. Preferably a description about what the custom code will do on your website.
- Go to the code recipe you want to use, select and copy the code.
- Go back to “Snippets” in your WordPress admin area and in the “Code” section, write or paste in your custom code gist/recipe in that box.
- When pasting in your code, note the
<?phptag is already added by default, do not add that line at the beginning of your code as it will trigger a fatal error.
- If there are any errors in your code such as a missing comma, the editor will indicate an
‘x’sign in front of the line(s) of code with the error.
- By default, the “Run snippet everywhere” select box is checked, do not change that.
- Click on “Save Changes & Activate” to run your custom code recipe on your WordPress site.
- Go test or view the customization that you added to your WordPress site.
We are Here to Help
Adding customization to your WordPress membership site can at first feel overwhelming, especially for the entry-level WordPress user. Although the Code Snippet Plugin has made this transition easier we recognise some users need help to use and implement custom code to their sites.
If you are having trouble using the Code Snippets Plugin or getting errors in your code recipe, please reach out to our support team in the Member Support Area (available to Plus members). Here you can receive hands-on guidance and help.
The Paid Memberships Pro team also recommend an alternative method to add custom code by creating a Custom Plugin. You can read more on how to create a customization plugin here.