WordPress.org

Ready to get started?Download WordPress

Forums

adsense integration in author bio (5 posts)

  1. otectom
    Member
    Posted 3 years ago #

    this is my second post of this question, please don't hate me for the repost.

    My site is being setup for multiple authors. Each author has their own adsense account and is allowed to post their own ads with their posts. To streamline this process (for both them and me) i would like to place their ad code in the author bio section of each authors profile. This way their ads would be automatically attached to every post they make. The problem I'm having is that wordpress clears the authors bio when I add the script to it. Does anyone know how to get around this?

  2. Matthew Denton
    Member
    Posted 3 years ago #

    Hi, it sounds to me like you should add a new custom field to an Authors profile to store the code you want. My suggestion is to have a look at Adding and Using Custom User Profile Fields.

    I do this to save user's amazon affiliate tags and it sounds like it will work for your desired adsense functionality.

  3. otectom
    Member
    Posted 3 years ago #

    Thank you so much!!

  4. cmchristou
    Member
    Posted 2 years ago #

    Did this work for you, otectom? I'm looking to do something similar.

  5. cmchristou
    Member
    Posted 2 years ago #

    Okay. I know this thread is pretty much dead, but I found it pretty hard to find info on how to do this, so here's how it's done. Hopefully it will help anyone else who needs it.

    First, paste this into functions.php:

    [code moderated - please follow the forum guidelines for posting code]

    Then paste your Adsense code into the neccessary text boxes on your profile page in WP.

    Then paste <?php the_author_meta( 'adsense1' ); ?> or <?php the_author_meta( 'adsense2' ); ?> where ever you want the ads to appear.

    It's actually not as hard as WordPress makes it. I would happily turn this into a widget if I knew how. Maybe someone else here can do it.

Topic Closed

This topic has been closed to new replies.

About this Topic

Tags