We understand this is annoying. But without advertising-income, we can't keep making this site awesome for you.
Please disable your adblock and script blockers to view this page. Appreciate! 🙏
MaomaoChiaEnglish Articles3 Easy Way to Add Custom Code, Javascript, Script to WordPress

3 Easy Way to Add Custom Code, Javascript, Script to WordPress

by MAL CHIA

Today tutorial is about 3 Easy Way to Add Custom Code, Javascript, Script to WordPress. I know as a newbie WordPress player, we don’t even know what is javascript or custom code. When we research to customise something that we like, many tutorial tell us to add some code, but we don’t even know where to place this code. This is the problem that many people like me facing. (but obviously this is few year ago of me)

Thus, today I’m going to teach you how to Add Custom Code, Javascript, Script to WordPress and make your WordPress website to another level.

 

1. Use plugin Code Snippets – add custom code to WordPress Page

The first way is simply use a free plugins call Code Snippets to add custom code to WordPress page. Code snippets is very flexible and powerful, you also can add new coding to better organise your custom code. Simply add a name and fill in your script, the plugins will do the rest.

WordPress Add Custom Javascript Code - Javascript Plugin WordPress code snippets

 

2. Use plugin Header & Footer – WordPress add script to header

For people who like to add some script to header & footer, just simply download this plugins name called Header & Footer it will make WordPress add script to header or footer. Other than that, you can also add some tracking code like google analytics, facebook pixel, Google Adsense or more here, Very useful!

header footer scripts plugin - 3 Easy Way to Add Custom Code, Javascript, Script to WordPress

 

3. Use Function.php – add javascript to WordPress

If you don’t like to rely on plugins, then you can try add javascript to WordPress from Function.php. Hence, here is how you can find your function.php and placing the javascript.

  1. Go to file manager on Cpanel.You must access your Cpanel to do the editing, avoid directly edit those code in WordPress editor, because it will break your website.
  2. Find the function.php file.Path: wp-content/themes/[theThemesName]/function.php
  3. Paste the javascript code.No matter what’s writing in the functions.php files just paste the code to the bottom at the last.

Use Function.php - add javascript to WordPress

Related tutorial:

  1. How To Get Post Featured Image URL In WordPress
  2. How to set Html lang attribute in WordPress
  3. How to Change WordPress Password Protected Text without Plugins Custom for Every Page
  4. How to Display Last Updated Date Posts In WordPress (Stepbystep)
  5. How to Get Custom Field Value in WordPress (Display WordPress Custom Fields)

 

You may also like

Leave a Comment