Print affiliate link in theme?

How can I print a blogs affiliate link in a theme template?

If affiliate, link to home with affiliate ID, else, link to home.

Thanks

  • Andrew
    • Champion of Loops

    Hiya,

    Affiliate links are per user instead of per blog. So there’s really no automated way to do it as blogs can have multiple users.

    The best thing to do is just have the users use a text widget to display their affiliate link.

    Thanks,

    Andrew

  • nightlyfe
    • Design Lord, Child of Thor

    OK, how can I get the affiliate ID of a user and, say.. show that affiliate link instead of the post_author link?

    Is it a variable that is accessible in the loop?

    How about in the footer of a single page (post author affiliate id)?

    Is there a function that needs to be added to allow this?

    Can you add an option to the blog settings to be able to give the blog owner credit for links? The administrator of the blog would set a “default” affiliate ID (their own) and then other authors would get credit on their own posts.

    Can the affiliate code be added to *any* inbound link?

    home.com/whatever?ref=USER-ID

  • Andrew
    • Champion of Loops

    Hiya,

    The affiliate ID (reference) is stored in he usermeta table with the meta key of ‘affiliate_reference’. Ex:

    $reference = get_usermeta($user_ID, ‘affiliate_reference’:wink:;

    $user_ID being the ID of the user you want to grab the affiliate data for.

    Is it a variable that is accessible in the loop?

    No. You would get the data from the usermeta table. See above.

    How about in the footer of a single page (post author affiliate id)?

    Again, you would need to get the data from the usermeta table.

    Can you add an option to the blog settings to be able to give the blog owner credit for links?

    I’m not really sure if that would be a popular feature.

    Can the affiliate code be added to *any* inbound link?

    I believe that is now possible.

    Thanks,

    Andrew