This section shares a powerful WordPress plug-in for inserting snippet code: WPCode.

WordPress adds code snippets:

This plugin adds different code snippets to various areas of our standalone site. Of course, you may find it difficult when I talk about code snippets here. In fact, it is very simple. For example, we need to put this code into our independent station for our webmaster tools or our Google statistics code. We need to count our visitors, including our transaction orders, etc., that is, to track some data on our independent website.

Then, we need to use some code like this, which we call code snippets.

1 Google Stats Code Snippet

Of course, in addition to such JS code snippets, you can also add some HTML code snippets, CSS code snippets, or PHP code snippets. In fact, these code snippets often do not require us to write them manually. The most important thing is, if we have such a code snippet, how can we add it to our independent station?

WordPress header file location:

If you understand the template structure of WordPress, for example, we can find the editor of the template file in the theme or enter the server to edit. Then, if we want to tell this code of Google statistics, we need to It is added to our header, so if you understand the code structure, you can easily find the header file of the template.

2 Add code snippets via wordpress theme editor e1714190945941

For example, here we can see a Theme Header, which is actually our header.php. After you open it, you can find its head tag. For example, this is the end tag of the head. Then, you can put your statistics code in this position. If it requires some code to be placed at the bottom, we also need to find its bottom file, but there is one where many people don’t know much about the code and are afraid of making mistakes.

WPCode plugin function description:

The other is that our theme will be updated regularly. After you update it, the code in your home will not be found unless you use a child theme. At this time, we need to use a plug-in to help us add these codes to a specified location. The best of them is WPCode.

This plug-in has several functions. The first one is that it can add different code snippets to our head or bottom. Of course, we can also add different code snippets to our body.

3 WPCode Plugin Core Functions

You can also connect to some social media. For example, if you do Google Ads promotion, that is, Google bidding or Facebook promotion, then when placing these ads, you also need to add some tracking codes. Hence, this plug-in also helps you complete the statistics of some specified effects. In addition, you can add some custom codes and certain logic to these codes. For example, they can be opened on certain pages, or Only one user can see this code, but no one else can.

In addition, if your site has errors, it can also help you fix them. The most powerful thing is that this plug-in provides a lot of code snippets. For example, we can turn off the comment module of the entire independent station or add some other functions. It has been written for you, and you only need to put or download it into your independent station and then use this plug-in to call it.

So, if you don’t understand the code, this plug-in is your savior, and its main functions are as follows:

How to use wpcode?

First, we find plugins. We have prepared this plugin, which currently has a high version of 2.1.5.1. The other one is some additions to pixels, including our Facebook and TikTok.

Now, we go to install this plug-in, directly install the highest version of the main program, click to open the installation and activate it directly after the plug-in is successfully installed.

After activation, we can see in the function button on the left that there is a function button for Code Snippets. We click to open it. Well, this is actually its operation interface. Here, we can write some of our own code and then add it inside.

4 WPCode Code Snippets List e1714191211507

wpcode insert headers and footers:

We can also add code to its header and footer. Among the several functions mentioned here, we use them most often to find the header and footer and add some of our pixels for advertising. Of course, Some codes in its code base are used to add, and others are rarely used. For example, if we customize some HTML or CSS, we will often add and use it on our independent page. Elementor module or Wpbakery Module, this plug-in is rarely used to add. For example, we need to install the statistics code for our site now. Now we have generated the statistics code, so we will copy it. How to add it after copying it?

In our header, here we need to find its header, and then in the header, we can see that we can add it to this tag of our header tag.

5 WPCode header add google stats code e1714191323636

The other is our main body and our bottom. Here, it requires us to add it to the header, so we just paste it directly into the header. After pasting it, save it. After saving, let’s refresh our page again and check whether it was added successfully.

After refreshing, we right-click in a blank space to view the web page’s source code. Let’s look for our header. In the header, we can see that this is the Google statistics code we just added, which is exactly the same as this one. This way, we can easily complete it.

6 WPCode View Added Google Stats Code

If it also needs to add content at the bottom, you can add it at the bottom. If it is for multiple platforms, you can arrange it below and add it in the same position.

WPCode Social Media Connect:

The second one is the pixel, but we need to use another add-on component for this pixel. We need to install this plug-in, add new to our plugins, and then upload the plug-in. Of course, these code plug-ins cannot be upgraded. The upgrade does not have much impact. We click to install it. After the installation is successful, we can activate it.

After activation, we will also find the function button of Code Snippets, and then there will be an additional pixel add module below. The pixel link is here. You can add Facebook’s pixel ID, including its API token. For example, the following is tracking some content in our store, such as our page views purchases, and checkout. The last one is our purchase activity. Under normal circumstances, we check all four of these, including the number of views of our page. This is for Facebook, and it is the same for Google.

7 WPCode social media tracking pixel added e1714191470416

The ID of Google statistics, for example, the site statistics we generated just now, has an ID. You can copy the ID, put it in this position, and then call it.

The following is also tracked, such as our pageviews, purchases, and the start of checkout, as well as our purchase activities and conversion events, mainly for attribution processing when we count statistics and for those who have done some Google placement. We all know that attribution is important.

WPCode library:

The next one is Pinterest, which is also a social media platform. If you place ads here, you can also add them and track them, including TikTok and some others. This will prevent us from worrying about it even if we don’t understand the code. You can add these advertising materials or pixels, its second function.

Then, add some modules. For example, we see the first code here that you added before. For example, let’s see what the first code is. It closes the comment module of the entire site. So what’s inside? In fact, the code was not written by me but was called by its database. There is a code snippet library in it. We can call it directly here. We click to open it. After opening it, we can see that there are There are a lot of codes, because we are now in a PRO version, so the codes in it can basically be used. If you can’t use some codes, just go to its official website to register an account and link it.

8 WPCode Added Code Snippets

9 WPCode Code Snippets Library

WPCode library insert demo:

For example, let’s go to the link directly. I have already registered an account before. After the link is successful, you can use all its codes. For example, we see one of the codes which allows our site to upload. If you want to use this code for modules like SVG, click to use it. In this case, you can directly download it to our code snippet library, our first code snippet. Of course, you can give it a name here. Then, the following is for different modules, such as automatic addition, or we pass a code and put this code on the page we specify. In addition, you can give the decoding a name. Generally, we can automatically let it insert it.

10 WPCode code snippet added location settings e1714191787528

Then, here is where to insert it. For example, insert it into the header, the footer, or any position inside the body. Normally, we put it inside the header.

Of course, if there are some less critical code statistics, we can put them in the footer. Then, you can set a validity period for this code, such as its start time and end time, during which this code is valid. Yes, if it is passed, this code snippet will be automatically closed.

The following item is mainly aimed at whether the device is added to the computer or mobile phone. Generally, we add it to all devices by default.

11 WPCode code snippet to display device settings e1714191820364

There are some other things below that we don’t need to worry about. At the bottom, you can add a tag or reminder to this code. These are not particularly important. After adding it, save it. After saving, it will enter Inside our code snippet.

WPCode close blog comments:

We click on the first one, which we just added, but this code is not yet effective, so you still need to activate it here before it can take effect.

For example, if we open our blog page now, each of our blogs will normally have a comment module. We see that there is a comment here. We can use the code of the comment module to activate it. After activation, we will refresh it now. On our blog page, our comment module is automatically turned off. This is actually the function of code.

12 WPCode code snippet disable full site comments module e1714191903375

There are many others; you can check them out to see which suits you and then use them.

WPCode log and data import:

This is its custom code and its code base, so we rarely use the other two, but if you are interested, you can also study it, and then we will continue to go back to the background and take a look. , of course, there are some tools here. Of course, this tool is mainly for import and export. You can import the code from the current site into another site and see some information about our system, including some logs.

13 WPCode Code Snippet Plugin Tools Module e1714191971239

WPCode Pro license:

There is another one below that is its settings. In fact, there is nothing in its settings. It is mainly one of our activation codes, but ours is currently activated, so you don’t need to worry about it. The other one is our edit box. When we edit the code, the height of its box is our default of 300 pixels or automatic. If there are some wrong logins, you can also count the logs, and then you can check the logs.

14 WPCode Code Snippet Plugin Settings e1714192021931

In addition, this plug-in will add a quick entry to our top toolbar, and you can close it. The next one is its permissions, that is, who can see some functions of the code snippet editing plug-in. For example, we can target administrators and other content, including adding HTML JS or CSS code. You can also authorize it, including PHP. Addition of code. The last item is not allowed to add PHP code because our WordPress is built using PHP. Adding some PHP code will easily cause errors in our system, so if you are not familiar with PHP code, you can turn this off. This is the main function of the wpcode plug-in.