I am working with a magazine client who sells adversiting offline in their magazine and now has a WordPress online magazine. Each of their stories is broken into different posts, and they are using the Wootheme Spectrum.

They want the ads in the magazine to correspond to the ads online. So if Story B has Ad Z, then online, Post B should have Ad Z in the sidebar. However, Story A and C might have differents ads.

What's the best way to accomplish this?

  • Custom plugin?
  • Plugin?
  • Adsense?

Thank you.


Hi @ewakened:

The simplest solution would be to have them upload the ads as photos using the media features in WordPress and then to have them add custom field called "Advertisement" with the URL to the ad copied from the media module, and a custom field called and "Ad URL" to link to the advertiser's site. Then in the theme use the following to retrieve the add's URL:

<a href="<?php echo get_post_meta($post->ID,'Ad URL',true); ?>">
   <img src="<?php echo get_post_meta($post->ID,'Advertisement',true); ?>" />

Beyond that is would be very possible to create a custom metabox plugin that would allow them to upload one of more ads directly into the post edit screen but that would require more programming.

| improve this answer | |
  • 1
    I agree with Mike. I had to do something similar but using OpenX. Why add complexity without a clear business requirement? – Ethan Seifert Jan 4 '11 at 0:12
  • @ewakened - Glad I could help. – MikeSchinkel Jan 4 '11 at 23:06

I'd say best way depends on:

  1. How many different ads
  2. How many different posts
  3. How much manual vs programmatic management
  4. Are ads managed by completely in-house staff or will there be externally accessible (like purchasing ads) aspects

There are plenty off-the-shelf plugins to manage advertisement, I'd try first to compile list and evaluate those.

For self-developed solution I'd consider factors above to choose:

  • how to store ads (custom post type, meta fields, hardcoded list, etc)
  • how to relate them to posts (for meta fields this solves itself, rest can get tricky)
| improve this answer | |
  • Thank you very much for this advice. I did just that and found that some of the plugins were good, and others weren't. In the end, I think I will use something like BuySellAds, but for now, I am going to use a simple technique as explained above. Thank you for your time and contribution. – ewakened Jan 4 '11 at 22:24

There is a plugin called custom sidebars that allows to determine what sidebar will be shown for each post


Once installed you can create the sidebars with the ads you need and assign them to the posts.

| improve this answer | |
  • Not a good approach, I think. First what if there is thousands posts? Thousands sidebars in admin interface would be terribel. Also as I remember when sidebar disappears widgets may shift and end up in different sidebars, because internally there are some numerical ids. – Rarst Jan 4 '11 at 17:30

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.