add custom code to WP

How to add Custom Code to WordPress

Last modified: January 13, 2020

Cloudways

There are many reasons you might want to add some custom piece of code into your WordPress blog. One of those reasons could be some tracking code or a snipped that a third party needs you to add to your homepage in order to verify your ownership of the site. Assuming you have no knowledge of HTML this could be a bit of a difficult task but I’m going to teach you a very simple way to do this.

The way a dynamic website (such as WordPress) works is that areas of the site that are identical on every page are written on 1 file and just included on every page. So, technically if you were to add your custom code to a file called footer.php or header.php the code would repeat throughout the site. However, what if you only want the code to appear on one page and not throughout the entire site?

header and footer plugin

The Header and Footer WordPress Plugin

If you are a Scan WP fan and use it frequently, you might notice this WordPress plugin show up quite a bit. It has a few very simple features that can help the non savvy code users.

  1. You can add any code on the homepage alone
  2. You can add code before or after each post
  3. You can add code before or after each page
  4. And a few more nice features.

 

There you have it. Assuming you are not familiar with HTML or coding in general, this plugin is the one for you.

Header and Footer

Show More

* This button will show the rest of the post and open up an offer from a vendor
Save 4 Later
Email liked links to yourself