Rate Your Experience

Changing Themes (WordPress) : Hard-code existing placeholders

Modified on: Fri, 9 Feb, 2024

Ready to change WordPress themes?

If a site is planning to change the themes, there's a chance revenue could be impacted short-term by disrupting the placeholders that were inserted using the Ezoic Chrome Extension. You can prevent this using the instructions below.

Do I need to worry about this?

Some sites may be largely unaffected by changing themes and re-adding placeholders. Unless your site fits one of these descriptions, you can probably change themes and re-add placeholders without any significant impact (assuming you set up placeholders as well as they were set up on your previous theme).

1.) If your site has been using Ezoic for more than 6 months

2.) If your site currently gets more than 50,000 pageviews a month

3.) If your site had a custom or complex placeholder configuration to start with

If your site doesn't fit any of those criteria, you can likely change themes and re-add placeholders with no real impact on revenue.

Will changing a theme really impact my revenue?

If your site used the Ezoic Chrome Extension to insert placeholders, POTENTIALLY YES. Changing a theme could delete existing placeholders causing a short-term impact on revenue. This is not something that will impact ad revenue long-term. Sites that have been using Ezoic for a long time, or have gotten close to 1M visitors optimized via Ezoic, may be the ones who see the biggest impact days following a switch if they don't take the steps below to mitigate the risks.

Can I prevent losing revenue when changing themes?

Yes, by hard-coding placeholders prior to switching. It is now easy to change your theme and keep all of your placeholders, including any data they have collected.

What does hard-coding placeholders mean?

The difference between using the Ezoic Chrome Extension and hard-coding to add placeholders to your website is the way they are implemented. Since Ezoic doesn't use actual ad units, but rather potential locations that ads are tested in(but not always shown), the Ezoic Chrome Extension uses the Ezoic Cloud to add the placeholders virtually, whereas hard-coding actually inserts the placeholders onto your website via a plugin or tool. 

Hard-coding vs. the Chrome Extension

Both methods achieve the exact same thing and there's no advantage one provides over the other in terms of speed or revenue. The only difference is when a theme changes, the hard-coded placeholders will be in the same locations of the new theme, while the Cloud inserted placeholders will have to be re-inserted and could lose valuable data for optimization.

How to hard-code placeholders and change your theme

To begin, you'll need a means of adding your existing placeholder code in your EzoicAds dashboard to your WordPress website (created from when you used the Chrome extension to add them to your site). In this example, we'll be using the Ad Inserter plugin available for free in WordPress. 

Step 1: Do this Before Activating a New Theme

Download Ad Inserter.

Ad Inserter, like all plugins, can add additional loading to your website; however, there are some ways of ensuring these don't impact your site speed very much.

Alternatives to Ad Inserter are:

Go to your WordPress plugins, click to add a new plugin, and search for Ad Inserter or another ad code or script injection plugin.

Once you find or download the plugin, click activate.


After it's activated, Ad Inserter will appear in your menu on the left-hand side in Settings

Step 2: Copy Ezoic Code to Ad Inserter

To get the codes for your existing placeholders, navigate to your Ezoic dashboard and select EzoicAds. 

Hit Ad Positions > Placeholders. This is where the placeholders created using the Chrome Extension are. You can copy the codes from these placeholders and then paste them into their proper locations on pages using Ad Inserter to hard-code all existing placeholders to your website. This way, you can change themes without losing your placeholders.

To start, click the embed button next to the placeholder.


A dialogue box will appear with the code.


COPY^ This

Copy each code, 1 at a time, and return to the Ad Inserter area in your WordPress admin. Paste the code into Ad Inserter.


No matter what tool you use to copy/paste codes into your WordPress site from the Ezoic dashboard, make sure that you insert the placeholder codes according to where they are set to display already...

Example: "Under the First Paragraph" would need to be pasted into Ad Inserter (or alternative method) in a div or container that will insert the ad placeholder under the first paragraph

In Ad Inserter: You can customize where you would like the ad to show. Posts is automatically selected, but you can also include Static Pages, Homepage, Search Pages, Category Pages, and Tag/Archive Pages.

Next, to place the code in the proper spot, you'll need to change the Insertion

Here is where you will insert the same placeholders as the ones you already have on your website. For this example, if we have a placeholder already set up on our website through the Ezoic Chrome Extension for Under First Paragraph, we will want to add an After Paragraph placeholder through Ad Inserter and signify it should appear after the first paragraph. Once completed, click Save Settings.


Regarding 'top of page', 'bottom of page', 'sidebar' placeholders, we would recommend using the 'before' or 'after HTML element' options. Example below:


If you then select the 'Open HTML Element Selector' option, it will load the site in a new window. You can then select the element that you want the placeholder to appear before or after, and then click 'Use' at the top of the page:


This will then fill the bit of code you need for you:


Repeat this step for all your existing placeholders.

Since the placeholders are now hard-coded, you can edit their attributes from the Chrome Extension, or by logging in and doing it directly from the EzoicAds dashboard under Placeholders (where you found the codes to transfer when you started hard-coding them).


Step 3 (Last Step): Confirm hard-coded placeholders

For the next step, you will need the Ezoic Chrome Extension added to your browser.

Open your website in Incognito mode; the Chrome Extension will not work if you are using a browser logged into WordPress.

Click the Ezoic Chrome Extension and select Update Placeholders. Then click Create and then select Location. This will activate the detect feature of the Chrome extension and will show you the placeholder you just hard-coded in with Ad Inserter.


You can see how all of these placeholders look on your website by following the Chrome Extension steps mentioned before. If you need to edit any of the placeholders, you can simply select the dropdown menu on the placeholder or navigate to the Placeholder section of your Ezoic dashboard to edit the placeholder settings.

Your placeholders are now hard-coded onto your website and will carry on to your next theme.

COMPLETE: Change Theme

You can now go to Appearance in WordPress admin and change to your desired theme.

Note: Since these placeholders are hard-coded using Ad Inserter (or alternative), it will need to remain activated on your site to keep the placeholders active (i.e. don't deactivate whatever tool you used to add the placeholders after activating your new theme)

Loading ...