This is the Targeted Ads Approach
Wouldn’t it be great if you could plop a targeted message in front of visitors eyes, and increase conversions??
Do you have a site with a broad central topic, and lots of sub-categories, where you display ads? Sometimes you wish you could deliver an ad based on the category, tag, or even the sidebar. It’s pretty easy to do, and in this scenario it involved a bit of HTML and some PHP conditional statements.
First, the PHP. Let’s begin by displaying an ad on a post by categories.
Replace this text with the html to display the product for Copywriting Basics
Replace this text with the html to display the product for Copywriting Creativity
Replace this text with the html to display the product for Copywriting Freelancing
Place the html code for the product you want to display on all other categories. Leave this blank to display nothing on all other categories.
In the “Replace the html…” sections, we will do just that. Let’s put together some code to do that.
Sample HTML:
This is the Targeted Ads Approach
Wouldn't it be great if you could plop a targeted message in front of visitors eyes, and increase conversions??
Of course, I’d recommend flushing that inline CSS out and attaching it to a div class, but you get the idea. You can change up the wording, affiliate link, and image for each snippet you insert.
But wait, there’s more. Here’s an example of how to do the same things, only using your sidebar:
php if (is_home() ) { ?>
The above example is more or less using the same code as what I outlined in a previous post, creating multiple sidebars.
In this case, you would insert the HTML snippet wherever wanted it to appear on each sidebar file. Once you have a sidebar you can load it by the category name/id.