WPCode Logo

WPCode Documentation

Documentation, Reference Materials, and Tutorials for WPCode

Most Popular

Get free tips and resources right in your inbox, along with 500+ others

Follow Us

What Type of Snippet Do I Need?

The WPCode plugin includes 6 types of snippets:

  • HTML
  • Text
  • JavaScript
  • PHP
  • Universal
  • CSS

Each of these types of snippets allow you to achieve specific objectives and below we’ll go into detail to make it easy for you to choose the right one for your needs.

HTML Snippets

The HTML Snippets are most useful when you want to quickly add a script to your site by simply copy-pasting the code from a provider. Some example scripts you could use are: Tracking scripts (Google Analytics, Facebook Pixel, etc), Adding ads to your site or any other script where you need a quick way to add some HTML code to your site.

The HTML snippet can also be used to create more advanced layouts for things like a banner or an ad but you might be better off using the text snippet for those.

Text Snippets

Text snippets use a different editor from the others – if you’ve been using WordPress for a while you are probably familiar with the editor. These type of snippets are not code-focused (although you can switch to the code tab anytime to edit the HTML directly). You can easily insert images or other media files and even use shortcodes from other plugins to extend their functionality really easily.

JavaScript Snippets

JavaScript snippets are meant to be used if you want to insert and execute JS code directly, you don’t have to wrap the code in <script> tags as it will be automatically wrapped when executed.

PHP Snippets

PHP Snippets are very powerful and with them you can execute almost any type of PHP code to add new features or disable functionality using WordPress hooks and more.

You will notice that most of the snippets you can generate using WPCode’s in-plugin generator are PHP snippets as they add specific functionality to your site.

Universal Snippets

Universal Snippets are similar to PHP snippets in the sense that PHP code will get executed but they allow you to add code similar to how you would add it to a .php file combining HTML and PHP.

This is a very powerful snippet type as you can use it to create template-like layouts or shortcodes to add elements that also include PHP code.

CSS Snippets

CSS or style snippets are available since version 2.0.4 & can be used for easily adding custom styles to your website while also taking advantage of all the powerful WPCode features that make it easy to choose where those styles are loaded. When choosing the CSS code type, the editor will automatically be optimised for CSS code and will provide instant syntax verification & autocomplete so that it’s easy for you to write correct code.

Still stuck? How can we help?

Last Updated on

Get Started Today & Add Your Own Snippets

Future-proof your website with WPCode Snippets and improve the way you manage code across all your websites.