12% off of LTD using this coupon: TWELVEPERCENTOFF. Promo ends on 2 Dec midnight UTC.
Published on Dec 7, 2020

Code Snippets vs My Custom Functionality

Sridhar Katakam

Two common methods you will see mentioned in our tutorials for adding code in Oxygen are Code Snippets and My Custom Functionality.

When do you use which? Is one method better than the other?

Code Snippets is typically used for adding code that does not involve adding directories and files on your server.

My Custom Functionality is typically used when you need to upload assets i.e., images, JavaScript and/or CSS files and enqueue (load) them usually, conditionally.

Whichever method you use, there is no right or wrong here.

Do note that there are some subtleties and adding the same exact code might work in one but not the other. Example.

Personally, I prefer using My Custom Functionality since I am quite comfortable working with code and edit the files using Visual Studio Code or Sublime Text.

Advanced Scripts is another option for you to consider. It is by the same developer behind the popular Hydrogen Pack.