Code snippets are a great way to make functional changes to your site that are upgrade safe. The power of WordPress and WC Vendors is that you can quickly build a marketplace without having to write any code. There are times you’ll need to make changes in code and this can be intimidating.
The following tutorial will show you how to quickly add code snippets to your WordPress marketplace with ease.
WC Vendors provides thousands of actions and filters for you to be able to customise your marketplace beyond the settings that we provide in the WordPress admin. We have created hundreds of snippets for our users to make all kinds of modifications to their sites safely. These snippets are to be placed in your themes functions.php.
Code snippets with no code
The easiest way to add code snippets to your marketplace is to use a plugin. There are several options available on the WordPress.org repository. We’ll be using the most popular one, Code Snippets.
Install Code Snippets plugin
- Go to your WordPress admin dashboard, then navigate to Plugins and click Add New in the menu.
- In the search box, type Code Snippets and click Install Now
- Click on Activate
Add WC Vendors Code Snippet
After you have installed the plugin, you will now be able to safely add code snippets to your site without writing any code.
Step 1. Click add new to add a new code snippet.
Step 2. Give the code snippet a name that is relevant. In this example, we’ll be disabling All in one SEO for our dashboard page. So we’ll name it that.
Step 3. Copy the snippet from our documentation site into the code section on the page. You do not need to add the opening PHP tag, as this is already added for you.
Step 4. Select the option that says “Only run on site front-end”.
Step 5. Add a useful description so that you can refer back to this later. Your future self will thank you.
Step 7. Click save and activate. Your code snippet is now active and in use.
If you have some experience with using code snippets and adding them directly to your themes functions.php, it is a good idea to add comments and notes. We recommend that when creating any modifications in your theme that you use a child theme and version control. This will help you track changes across the lifetime of your marketplace.