TOP OFFER - Click HEREWP Manage Ninja - Summer Special Discount up to 20% OFF

Code Snippets plugin

Jul 18, 2022

Code Snippets plugin for WordPress: The Best in town is now even better with the Pro Edition


Did you know that WordPress has a plugin that makes adding code snippets a breeze? It’s called the Code Snippets plugin, and it’s the best thing since sliced bread.

Code Snippets Plugin

A website owner can quickly insert code on their WordPress website with Code Snippets.

The plugin is excellent for anyone who wants to add tracking codes, woocommerce tweaks, or any minor adaption to the site and is easy to implement and use.

It’s still free but is now also available in a Pro edition.

In July 2022, Code Snippets Pro was released. I will describe the difference between the Free vs. Pro version and explain why you should upgrade to the Pro version.


Why is Code Snippets plugin for WordPress the best?

Code Snippets is the best code snippets plugin for WordPress because it is easy to use and has many features. It has a simple interface that allows you to add code snippets to your website easily. 

This plugin provides various options for users to create, format, and insert code snippets. It also includes several advanced features for those who want to customize their code snippets. It allows you to change the font, size, color, and style of the code. Another cool feature is the ability to change the order (priority) in which the code snippets appear on the page. It is handy for making a specific type of code snippet appear first or for displaying a block of code with a header and footer.

Code Snippets allow you to deactivate and activate a snippet easily. When you add a new code and there is an error in the code, Code Snippets will let you know and immediately deactivate it. A lousy code will not harm your website.

Code Snippets allows you to add PHP and Content HTML code. The Pro Version even goes a step further and lets you add CSS and Javascript codes. 

Unlimited code snippets are allowed.


Is a child theme still needed with Code Snippets?

A child theme is no longer required with Code Snippets Pro. With the Code Snippets Pro plugin installed, you can easily change a theme, and you don’t need to save first your CSS code. Add CSS code in Code Snippets Pro instead of the theme customizer in ‘additional CSS.’ Code Snippets does not store the PHP and CSS code in functions.php or style.css. It is entirely independently stored from the WordPress theme.

In my opinion, a child theme is only required if you use templates with special requirements.


Import / Export

Export each code snippet individually or in bulk and import it to another WordPress site. The Pro version lets you export a code snippet in JSON format.


How to install the WordPress Code Snippets plugin?


Free Version:


Code Snippets Plugin

Installing the WordPress Code Snippets plugin is easy. You can install it from the WordPress plugin repository or directly from the plugin section in the WordPress Dashboard. Activate it, and a new menu item, “Snippets,” will be added to the left WordPress navigation pane. 

All Snippets menu

Pro Version:

Buy the Pro Version from the Code Snippets website. You will get a welcome mail with a link to download the zip file. In the same mail, you will also find the activation code. 

You’ll find the ‘Upload Plugin’ button on Plugins, Add New. 


Code Snippets Plugin Pro welcome mail
Welcome Mail

How do I add code?

To add code, click on the “Add New” button in the top left corner of the Snippets page. A new window will open where you can enter the title, description, code, and tags for your snippet. 

In the Free version, you have two choices to add codes, Function (PHP) or Content (HTML). The Pro version has two more options, Styles (CSS) or Scripts (JS).

Depending on the code, you decide where to run the snippet. For example <head> section or <body> section.


Add new snippet

Once you are done, click the “Save Changes and Activate” button, and your code snippet immediately runs.


How to run a snippet?

Generally, a code snippet runs on the whole website. But you can also restrict a snippet to run only on a specific webpage. 


Free Version:

Add this line near the top of your page to restrict a snippet from running on more than one page:

if ( ! is_page( 'Page Name' ) ) return;

Specify the title, slug, or ID of the page to run the snippet on instead of ‘Page Name.’


Pro Version:

The same applies, but the Pro version has a run code Gutenberg Blocki and a run code widget for Elementor. It is a clear advantage of the Pro version, keep the snippet clean and neutral and decide with the block where to run it.


Code Snippets examples


Facebook Pixel

insert the Facebook Pixel manually instead of using the official Facebook plugin.


<!-- Meta Pixel Code -->
<script>
  !function(f,b,e,v,n,t,s)
  {if(f.fbq)return;n=f.fbq=function(){n.callMethod?
  n.callMethod.apply(n,arguments):n.queue.push(arguments)};
  if(!f._fbq)f._fbq=n;n.push=n;n.loaded=!0;n.version='2.0';
  n.queue=[];t=b.createElement(e);t.async=!0;
  t.src=v;s=b.getElementsByTagName(e)[0];
  s.parentNode.insertBefore(t,s)}(window, document,'script',
  'https://connect.facebook.net/en_US/fbevents.js');
  fbq('init', 'insert Pixel ID here');
  fbq('track', 'PageView');
</script>
<noscript><img height="1" width="1" style="display:none"
  src="https://www.facebook.com/tr?id='insert Pixel ID here'&ev=PageView&noscript=1"
/></noscript>
<!-- End Meta Pixel Code -->

RankMath FAQ Gutenberg Block (CSS)


The RankMath plugin has a nice FAQ schema block. Unfortunately, the paddings are too narrow, which makes it look not so nice.


.RankMathFAQ {padding-bottom: 1.5em;}

Rank Math disable Content AI check (PHP)


I don’t use Content AI which is a feature in Rank Math.


<?php

/**
 * Filter to disable Content AI test.
 */
add_filter('rank_math/researches/tests', function ($tests, $type) {
	unset($tests['hasContentAI']);
	return $tests;
}, 10, 2);

Woocommerce round coupon/voucher code (PHP)


In Switzerland, we like to round the amount to 5 Rappen.


add_filter( 'woocommerce_coupon_get_discount_amount', 'mmx_round_coupon_amount' );
function mmx_round_coupon_amount( $discount ){

// round up
$rounded = ceil( $discount / 0.05 ) * 0.05;

// round down
// $rounded = floor( $discount / 0.05 ) * 0.05;

return $rounded;

}

Code Snippets Free vs. Pro

Here are the main features compared.


FeatureFreePro
Import and Export
Unlimited Snippets
Activate and Deactivate Snippets
Community Support (Facebook Group)
PHP snippets
Content snippets (html + PHP)✅ (limited)
Gutenberg Block - run code
Elementor widget - rund code
Gutenberg Block - show source code
Elementor widget - show source code
CSS snippets
Scripts (Javascripts
Ticket Support
Minify snippet output
Cloud storage (coming soon)
Cloud snippets (coming soon)

What are the main benefits of going Pro?

  • fewer plugins required
  • no more child themes
  • CSS code
  • Javascript code
  • browser caching for optimal efficiency.
  • ticket support
  • minify snippet output
  • Cloud Support (coming soon)

A plea

If you’re planning to buy Code Snippet Pro, please use my affiliate link to purchase it. Absolutely no additional cost for you (I would earn a commission from the seller), but definitely a huge help for me, as your gesture will contribute to covering the costs of maintaining this website and adding more great articles. Thanks in advance for your support!


Code Snippets plugin: Pricing

There are three price plans available. The only difference is the number of website activations. Furthermore, you can decide between Subscription plans or a Lifetime deal.

According to the official website, Lifetime deals are only available during launch.

Code Snippet Pro is backed by a 14-day money-back guarantee.


Code Snippets Pro Pricing Yearly

Code Snippets Pro Pricing Lifetime

Coming soon / Roadmap

Currently in development is Cloud Storage. It will enable you to host your snippets in the cloud. It will make it easier for you to manage and share your code snippets across your websites. No further details are known at the moment. 

Also in the works is a cloud community, an online place where you can share code snippets with other fellows. It is probably the most exciting upcoming feature. 

Both upcoming features will be included in the Pro plan without additional cost.


Summing up

The Code Snippet plugin is not a new kid on the block. It is constantly being improved and updated with new features. The free version is over ten years old and has an install base of over 600k+. It is rated five stars on WordPress.org. The Pro version goes further and adds support for CSS and Javascript codes. I think Code Snippets Pro is the best code snippets plugin for WordPress. Support the development team and go Pro. You will not regret it.

I will constantly update this article when new developments arise.

Did you buy Code Snippets Pro? How did you like this article? Please let me know in the comment section below or drop me an email at info@edywerder.ch.


Full Disclosure

Any purchases made from clicks on links to products on this page may result in an affiliate commission for me.

As an Amazon Associate, I earn from qualifying purchases
Als Amazon-Partner verdiene ich an qualifizierten Verkäufen

1 Comment

  1. Ivan

    Thank you Edy.
    Great article!

    Reply

Submit a Comment

Your email address will not be published.

Premium Choice



Premium Hosting