WordPress.org

Ready to get started?Download WordPress

Forums

Having a specific Ad per each post (8 posts)

  1. limeibook86
    Member
    Posted 4 years ago #

    Hello everyone,

    So I'm using WordPress at work to create a newsletter type blog. There would only be one post per month really. However, we have about 4 different ads in our header. They're just JPGs with URLs to link to the advertiser's page, think of it as one long banner but split up.

    Anyway, we need these ads to be tied to the specific post. For example the November entry would need ads A, B, C, and D to show. But the December post needs to display ads A, Z, Y, and X.

    Is this possible? I was reading elsewhere before and somebody mentioned a PHP script may work. I haven't dealt with PHP in a while, so I definitely can't make something up by myself. Currently the ads are in our header, however I can't seem to figure out how to make the header change when on a specific post. Is that possible at all?

    Any help with this would be very much appreciated.

    Thanks,
    -Steven

  2. MichaelH
    Member
    Posted 4 years ago #

  3. limeibook86
    Member
    Posted 4 years ago #

    Yes, thanks MichaelH for the post! :)

    This is where I saw the note of Ads per Post, however there isn't much more to go on then what is stated:

    Ads in Individual Posts

    Placing ads in individual posts can be done by simply including the code in the post in some cases. To include ads powered by PHP will require a plugin to allow the code to be executed. RunPHP and PHPExec let you embed dynamic PHP code and PHP based advertising in individual posts. To use Javascript-based ads in individual posts, see Using Javascript.

    I see you need a plug-in to run PHP - but I'd probably need an example of a PHP code to make this all work.

  4. MichaelH
    Member
    Posted 4 years ago #

    Then maybe you don't need that PHP plugin--couldn't you just put a link in each post as appropriate.

    Like

    <a href="http://www.yourcustomer.com" title="Your Customers Name"><img src="http://yourdomain.com/images/yourjpg.jpg"  alt="Your customer"  title="your title here" /></a>
  5. limeibook86
    Member
    Posted 4 years ago #

    Yes, but see the ad would not be in the particular post itself. Rather the ad would be in the Header of the page.

    So I would need something to change depending on the page. So if you clicked to post #1 it would show the ads specifically selected for that post above in the header. Then if you would click post #2, it would show those ads in the header for that post and not the previous ads.

    I'm sorry if this sounds a bit confusing, I'm trying to figure this all out myself as well. :)

  6. Andrew "Easy" Anderson
    Member
    Posted 4 years ago #

    There are a couple of themes that you can do this in with short codes. http://www.profitplatformpro.com can do this in about 2 seconds flat. I just tried the function out, but it is not public yet. Might want to look around for a new theme.

  7. limeibook86
    Member
    Posted 4 years ago #

    Well considering we just spent a lot of time editing one of the themes we got to make it look right and everything we can't go to a new theme.

    I guess this is much harder then I thought it would be. I guess as a last resort I can always float a CSS ad above on the page and make it stay there for each post. Although that wouldn't be the best solution.

  8. joehuffman2
    Member
    Posted 4 years ago #

    The easiest way to do this is to create custom fields (which will be post based) and creating ad keys (ad1, ad2, ad3, ad4, etc.) Then you would add the img/href code to the specific ad spot.

    Then you would add the template function get_post_meta in your theme. That would probably be the easiest approach.

Topic Closed

This topic has been closed to new replies.

About this Topic