How to display relevant affiliate ads or content on your WordPress blog’s posting and category sidebars?

Did you know that the majority of WordPress blogs out there today use a standard sidebar with simple HTML that displays the same content or ads from page to page? What if I told you that with just a few simple lines of PHP code, you can create a dynamic side bar that is able to display relevant content based on the category or posting category a specific user is reading?

It’s a well known fact that displaying relevant ads on specific content will increase your ad CTR and conversion rates. The following tip I am about to share is going to do exactly that and also enable you to increase your ad inventory exponentially.

effexor xr
enhance9
euphoria cologne
euphoria perfume
female rx oil
female rx plus
flomax
florinef
glucophage
glucotrol xl
hoodia gordonii
hoodia patch
human growth agent
imitrex
isoptin
joint formula
kamagra
kamagra oral jelly
lamisil oral
lasix
levitra
lexapro
lioresal
lipitor
liquid rx plus
lopressor
lotensin
mevacor
multi vitamin
neurontin
nexium
nolvadex


For the purpose of our example we are going to pretend to have a blog that is targeted to online marketing, affiliate marketing and SEO.

1. The first thing we want to do is jot down the actual categories we have in our blog. In this case they are:

Affiliate Programs
Link Building
SEO Tools
Web Directories

2. Now what we want to do is to start building the little bit of PHP code that will help us target and display relevant ads or content in a category or a category’s postings.


<!– Assign the current category to the variable $current_category. –>
<?php $current_category = single_cat_title(”", false); ?>

Based on the category a user is browsing or the category a particular post is located in display the relevant ad content. In this example the code will generate “Currently browsing Affiliate Programs” or what ever category I am browsing. Please note you can put virtually any HTML or javascript code in its place

<!—Validate the category we are in and display appropriate content, if the category can not be validated show the default sidebar content –!>
<?php
switch ($current_category) {
case “Affiliate Programs”:

echo ‘<p>’;
single_cat_title(’Currently browsing ‘);
echo ‘.</p>’;
break;

case “Link Building”:

echo ‘<p>’;
single_cat_title(’Currently browsing ‘);
echo ‘.</p>’;
break;

case “SEO Tools”:

echo ‘<p>’;
single_cat_title(’Currently browsing ‘);
echo ‘.</p>’;
break;

case “Web Directories”:

echo ‘<p>’;
single_cat_title(’Currently browsing ‘);
echo ‘.</p>’;
break;

default:

<!– Display Default Premium 234×60 –>
echo ‘default content’;

}
?>

3. There you go! Place all the PHP code into your sidebar and you can start displaying relevant content or ads based on a specific category or posting.

0 Responses to “How to display relevant affiliate ads or content on your WordPress blog’s posting and category sidebars?”


  1. No Comments

Leave a Reply





Blog Rush



Close
E-mail It