• Resolved LukeBurdekinHerald

    (@lukeburdekinherald)


    (I hope this is the right place to put this query)

    My website employs a partnership program where writers have their own adsense code (different ad units from the same account) and thus they have their own ads appear on their own posts (so they get paid that way).

    I had believed that I’d just be able to insert their ad code manually into their posts but the ads are not appearing. I can’t hardcode the ad code into the editor because, as I said, I need to display several ad units at a time. (1 post will have a different ad code to another).

    So how can I do this? Is there a plugin that specializes in this?

    Website: burdekinherald.com

Viewing 5 replies - 1 through 5 (of 5 total)
  • Simple Ads Manager is worth checking out.

    But to be clear–you are saying that each author has his/her own adsense code that you want to display in your advertisement area on your website? You want adsense code that is associated with an author to be displayed on all their posts?

    Thread Starter LukeBurdekinHerald

    (@lukeburdekinherald)

    Yes, they are to have their own code to be displayed on their posts.

    I was going to insert them manually but I can’t do that anymore. (I could 2 years ago).

    Well, I recommend trying out the Extra User Details plugin. It allows you to add new fields to the user profile section of the WordPress Backend.

    Create a field where they place their Adsense code block (or you). Then place the following code into the loop where you want the adsense code displayed:

    <?php the_author_meta('meta_key'); ?>

    Just replace ‘meta_key’ with ‘adsense’ (or whatever you name the field on the back end).

    This will work automatically on post pages, and single.php. Elsewhere, you’ll have to figure out what the author’s id, and pass it to the function as follows:

    <?php the_author_meta('adsense', 26); ?>

    The above block of code will get the “adsense” meta value (or, the adsense code, in our case) for user id #26.

    Remember that you’ll have to add an “echo” before the_author_meta for it to print into your template.

    Thread Starter LukeBurdekinHerald

    (@lukeburdekinherald)

    Thankyou very much.

    happy to help

Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘Insert different Adsense codes into different posts’ is closed to new replies.