Easy code snippets with no code and WordPress

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

  1. Go to your WordPress admin dashboard, then navigate to Plugins and click Add New in the menu.
  2. In the search box, type Code Snippets and click Install Now
  3. 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.

Click Add New to add a new 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”.

Make sure this will only run on the frontend.

Step 5. Add a useful description so that you can refer back to this later. Your future self will thank you.

Create a useful description so that you can easily refer to this at a later date.

Step 6. Add tags if you want to. This can help you with sorting multiple snippet.

Step 7. Click save and activate. Your code snippet is now active and in use.

Conclusion

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.

Jamie is the founder and lead developer of WC Vendors. He has been working in the WordPress, WooCommerce and Marketplace space for more than 15 years, 9 of those dedicated to multivendor marketplaces.

This website uses cookies to ensure you get the best experience on our website.