• 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

Viewing 7 replies - 1 through 7 (of 7 total)
  • Thread Starter limeibook86

    (@limeibook86)

    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.

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

    Like

    <a href="https://www.yourcustomer.com" title="Your Customers Name"><img src="https://yourdomain.com/images/yourjpg.jpg"  alt="Your customer"  title="your title here" /></a>

    Thread Starter limeibook86

    (@limeibook86)

    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. ??

    andrew-anderson

    (@andrew-anderson-2-2)

    There are a couple of themes that you can do this in with short codes. https://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.

    Thread Starter limeibook86

    (@limeibook86)

    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.

    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.

Viewing 7 replies - 1 through 7 (of 7 total)
  • The topic ‘Having a specific Ad per each post’ is closed to new replies.