If you’re a web code expert (or even novice) you can probably handle hard coding in sponsored links in your blog’s sidebar. But many people are unaware that you can manage text ads via your WordPress administration panel. It’s a small tweak/hack, but once you have it in place, adding and removing sponsored text ads will be a breeze from then on.
The first thing you’ll want to do is log into your WordPress administration panel. Click on “Manage” in the top-level navigation, then click on “Categories” in the sub-navigation. This is where you need to add a new category. For the purposes of this article, we’ll call it “Ads”.
After you add the new category, take a look in the list and find the Category ID (that will be located in the far left column). Once you have the category ID, we can move on to…
…The blogroll. Click on the “Blogroll” link in the primary navigation bar of your WordPress admin panel. Click “Add Link” in the sub-navigation.
Now you should have a form to fill in. Essentially, you’ll want make the “Name” the actual text you want to appear in your sidebar (the anchor text). After that, fill in the URL you want to link to. Go ahead and leave the “description” field empty.
Just before you submit the form, take a look to your far right. There, you’ll see a list of categories (probably only “Blogroll” and “Ads”). Uncheck the “Blogroll” category and check the “Ads” category. NOW you can submit the form.
Here comes the tricky part (depending on whether or not you like to edit WordPress theme files). Open your sidebar.php (or whatever your sidebar file is called) and create a new space. For the purposes of this article, I’ll use a standard widgetized sidebar format for my new list. You’ll basically want to add this (or something similar):
<li>
<h2>Sponsored Links</h2>
<ul>
<?php get_links(8, ‘<li>’, ‘</li>’, ‘ – ‘); ?>
</ul>
</li>
I’m not going to go into the explanation of this Template Tag, so for more information on that, go here.
I will, however, explain the “8” inside the parenthesis. The “8” represents the category ID we want to be displayed. Remember back when I told you to locate the category ID of the new category you added? That’s what will go where the “8” is in my code, so replace the “8” with the category ID you have.
The output will be a list of links that you place in that category. This gives you a quick and easy way to manage sponsored links, or any kind of link really.
Be sure to check out all the other cool things you can do with the get_links template tag. Use you imagination and you can come up with anything!
Happy Coding!