Title: can i use one code
Last modified: August 21, 2016

---

# can i use one code

 *  Resolved [bookworm480](https://wordpress.org/support/users/bookworm480/)
 * (@bookworm480)
 * [12 years, 2 months ago](https://wordpress.org/support/topic/can-i-use-one-code/)
 * to control my affiliate links?
 * [code+id] and when someone clicks it will go to that site? right now i added 
   a custom field when a user clicks the large picture they go to my sponsors site.
   thank u
 * [https://wordpress.org/plugins/thirstyaffiliates/](https://wordpress.org/plugins/thirstyaffiliates/)

Viewing 5 replies - 1 through 5 (of 5 total)

 *  [Josh Kohlbach](https://wordpress.org/support/users/jkohlbach/)
 * (@jkohlbach)
 * [12 years, 2 months ago](https://wordpress.org/support/topic/can-i-use-one-code/#post-4777377)
 * Hi bookworm480,
 * I’m not 100% clear on what you’re after but it sounds like you might be able 
   to use the shortcode option to achieve this.
 * At a minimum here’s what you need for the shortcode:
    [thirstylink linkid=”123″
   linktext=”the text you want to link”]
 * Where 123 is the ID of your affiliate link and you can replace the text with 
   whatever you like.
 *  Thread Starter [bookworm480](https://wordpress.org/support/users/bookworm480/)
 * (@bookworm480)
 * [12 years, 2 months ago](https://wordpress.org/support/topic/can-i-use-one-code/#post-4777378)
 * i want to put it in the attachment.php in place of the full image url. is there
   a way to attach the affiliate to each post?
 * right now i added a custom url in the media library its a pain pasting all the
   same url in each pic field
 * in attachment.php
    `<div class="attachment-image"><a href="[code+id]"><img src
   ="<?php echo wp_get_attachment_url(); ?>" alt="<?php the_title_attribute(); ?
   >" /></a></div>`
 *  [Josh Kohlbach](https://wordpress.org/support/users/jkohlbach/)
 * (@jkohlbach)
 * [12 years, 2 months ago](https://wordpress.org/support/topic/can-i-use-one-code/#post-4777424)
 * It’s a bit hard to know exactly what you’re trying to achieve without more context,
   but you could, in place of [code+id] in your code above, try something like:
 * `get_post_permalink($id);`
 * Where $id is the ID of your desired affiliate link.
 *  Thread Starter [bookworm480](https://wordpress.org/support/users/bookworm480/)
 * (@bookworm480)
 * [12 years, 2 months ago](https://wordpress.org/support/topic/can-i-use-one-code/#post-4777428)
 * im uploading food images when someone clicks the pic not the thumb they go to
   my affiliate link emailed you the demo
 *  [Josh Kohlbach](https://wordpress.org/support/users/jkohlbach/)
 * (@jkohlbach)
 * [12 years, 2 months ago](https://wordpress.org/support/topic/can-i-use-one-code/#post-4777437)
 * Responded via email, closing off this thread…

Viewing 5 replies - 1 through 5 (of 5 total)

The topic ‘can i use one code’ is closed to new replies.

 * ![](https://ps.w.org/thirstyaffiliates/assets/icon-256x256.jpg?rev=2686825)
 * [ThirstyAffiliates - Affiliate Links, Link Branding, Link Tracking & Marketing Plugin](https://wordpress.org/plugins/thirstyaffiliates/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/thirstyaffiliates/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/thirstyaffiliates/)
 * [Active Topics](https://wordpress.org/support/plugin/thirstyaffiliates/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/thirstyaffiliates/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/thirstyaffiliates/reviews/)

 * 5 replies
 * 2 participants
 * Last reply from: [Josh Kohlbach](https://wordpress.org/support/users/jkohlbach/)
 * Last activity: [12 years, 2 months ago](https://wordpress.org/support/topic/can-i-use-one-code/#post-4777437)
 * Status: resolved