Website Design TipsWordPress Tips

Add Codes To WordPress Head, Body & Footer Without Plugin (Working Perfectly)

Sponsored Links

This is a guide on how to add codes to WordPress head, body & footer without plugin easily on your site.

In this descriptive guide, you will learn;

  • How to edit your WordPress head, body and footer
  • How to add Google search consoles, Google AdSense verification code to your WordPress site head
  • Type of themes that accepts adding codes without plugins

Effects of using too many “unnecessary” plugins on WordPress site

Having too many useless plugins on your site contributes nothing than negatively impact your site’s speed. And when your site takes too long to load, you lose your precious audiences.

Apply Now:  Free WordPress Vs Self Hosted Blog: How To Convert Free WordPress To Self Hosted WordPress Blog

Let’s get started.

In this period when there are tons of plugins for almost anything you want to do on your website or blog, you can still do some wonderful stuff without plugins on your WordPress site.

If you are like me who don’t like using too many plugins, you will find this article useful.

Apply Now:  5 Important Questions Your Website Homepage Must Answer

How to add codes to WordPress head without plugin

The best way to use this code am about to share with you is to use a child theme of your main theme or a customized theme from scratch, although, it is works on parent themes too. But don’t forget, there is a possibility that the code will be overridden when you update the main theme. Not in all cases anyways.

Methods codes to WordPress website head without plugin

METHOD #1. Recommended if you know about theme edition should anything goes wrong.

Follow the steps below;

  1. Navigate to your theme editor
  2. Go to the head.php
  3. Below the <head> tag, you can paste your AdSense or google search console code
  4. Then save the changes.

DON’T Use this method if you don’t know what you are doing

METHOD #2. This is recommended. you can either use child theme of the main theme. But, not all main themes will accept this code.

Follow the steps below;

  1. Go to your theme editor as usual
  2. Navigate to function.php file
  3. Copy and paste the code below in the function.php

function prohead_function() {
echo ‘ADD YOUR CODE HERE’;
}
add_action(‘wp_head’, ‘prohead_function’);

  • Replace ADD YOUR CODE HERE with whatever code you are adding and then save your changes.

NOTE: To add more than one code, all you have to do is put a space in between the first and the code you are adding.

METHOD #3. You can go the plugin way.

Follow the steps below;

  • Go to your plugins section, click on add new and search for Quick AdSense, install and activate it.
  • Once activated, you will see the file at the left-hand-side of your WordPress dashboard as shown below.
  • Click on Quick AdSense and you will see the setting section for the plugin.
  • Cick on site head/footer codes section as shown below
  • In the head, you can add whatever code you want to add on the head section of your WordPress site
  • In the footer section, you can add whatever code you are instructed to add in your site body, above </body>. Just like this;
  • When done pasting the code, save your changes

SEE ALSO: How to apply for Google AdSense easily

How to add code to WordPress body without plugin

There are two methods to add code to your WordPress site body. See them below;

METHOD #1.

To avoid repetition, kindly follow method 2 discussed above.

  1. Navigate to the function.php file of your active theme
  2. Then copy and paste this code below in the function.php

function probody_function() {
echo ‘add your head code in here’;
}
add_action(‘wp_body_open’, ‘probody_function’);

  • Replace ADD YOUR CODE HERE with the code you are adding
  • Then save changes.

DO NOT FORGET: Anything added in the body section, will be visible on your site. Unlike head where the codes won’t be visible.

METHOD #2. Make use Quick AdSense plugin as shown in method #3 above.

As explained in the method 3 of the head section, do same for this method.

Example of codes to add to your site’s body

Addthis code for;

  • Share button
  • Recommended posts
  • Pop up form

How to add code to WordPress footer without plugin

This technique is the same as explained above. If you have a special code for your footer section, you can use this method for it inclusion.

To add code to the WordPress footer, follow the steps below;

  1. Go to your theme editor
  2. Navigate to the function.php file of your active theme
  3. Copy and paste the code below

function profooter_function() {
echo ‘add your footer code in here’;
}
add_action(‘wp_footer’, ‘profooter_function’);

  • Replace ADD YOUR CODE HERE with the code you want to add, edit as you want
  • Then save changes

MADE FOR YOU: How to create WordPress site with phone

Wrapping up how to add codes to WordPress head, body & footer without plugin

These are the techniques you can use to add any special code to your WordPress site, either at the head, body, or footer section. Using fewer plugins on your website can help in making your WordPress site load faster. 

Find this article useful, endeavor to share it with fellow WordPress users you know, and don’t forget to drop a comment below.

Sponsored Links

Leave a Reply

Back to top button