3 added 38 characters in body
source | link

I'm trying to construct an easy to use affiliate site, eacheach post-type has a custom field where keywords can be entered per post. ( using advanced custom fields plugin )

Then in a template I call that field into a URL like this :

<?php if( get_field('amazon_keywords') ): ?>
            <a href="http://www.amazon.co.uk/s/?_encoding=UTF8&camp=1634&creative=19450&field-keywords=<?php the_field('amazon_keywords'); ?>&linkCode=ur2&tag=AFFID"> More info Test dynamic Amazon</a>
    <?php else : ?>
            Something else
    <?php endif; ?>

This works and displays the link with the entered keywords.

PROBLEM

Because its an affiliate link, best practice would be to mask it. So instead of showing the affiliate link id like to show it something like :

website.com/goto/amazon 

Normally this is fine because I can just do a redirect, but the addition of the php inside the URL for the keywords is where I've stumbled.

Anyone have any ideas ?

I'm trying to construct an easy to use affiliate site, each post-type has a custom field where keywords can be entered per post.

Then in a template I call that field into a URL like this :

<?php if( get_field('amazon_keywords') ): ?>
            <a href="http://www.amazon.co.uk/s/?_encoding=UTF8&camp=1634&creative=19450&field-keywords=<?php the_field('amazon_keywords'); ?>&linkCode=ur2&tag=AFFID"> More info Test dynamic Amazon</a>
    <?php else : ?>
            Something else
    <?php endif; ?>

This works and displays the link with the entered keywords.

PROBLEM

Because its an affiliate link, best practice would be to mask it. So instead of showing the affiliate link id like to show it something like :

website.com/goto/amazon 

Normally this is fine because I can just do a redirect, but the addition of the php inside the URL for the keywords is where I've stumbled.

Anyone have any ideas ?

I'm trying to construct an easy to use affiliate site, each post-type has a custom field where keywords can be entered per post. ( using advanced custom fields plugin )

Then in a template I call that field into a URL like this :

<?php if( get_field('amazon_keywords') ): ?>
            <a href="http://www.amazon.co.uk/s/?_encoding=UTF8&camp=1634&creative=19450&field-keywords=<?php the_field('amazon_keywords'); ?>&linkCode=ur2&tag=AFFID"> More info Test dynamic Amazon</a>
    <?php else : ?>
            Something else
    <?php endif; ?>

This works and displays the link with the entered keywords.

PROBLEM

Because its an affiliate link, best practice would be to mask it. So instead of showing the affiliate link id like to show it something like :

website.com/goto/amazon 

Normally this is fine because I can just do a redirect, but the addition of the php inside the URL for the keywords is where I've stumbled.

Anyone have any ideas ?

2 added 10 characters in body
source | link

I'm trying to construct an easy to use affiliate site, each post-type has a custom field where keywords can be entered per post.

Then in a template I call that field into a URL like this :

<?php if( get_field('amazon_keywords') ): ?>
            <a href="http://www.amazon.co.uk/s/?_encoding=UTF8&camp=1634&creative=19450&field-keywords=<?php the_field('amazon_keywords'); ?>&linkCode=ur2&tag=AFFID"> More info Test dynamic Amazon</a>
    <?php else : ?>
            Something else
    <?php endif; ?>

This works and displays the link with the entered keywords.

PROBLEM

Because its an affiliate link, best practice would be to mask it. So instead of showing the affiliate link id like to show it shows something like :

website.com/goto/amazon 

Normally this is fine because I can just do a redirect, but the addition of the php inside the URL for the keywords is where I've stumbled.

Anyone have any ideas ?

I'm trying to construct an easy to use affiliate site, each post-type has a custom field where keywords can be entered per post.

Then in a template I call that field into a URL like this :

<?php if( get_field('amazon_keywords') ): ?>
            <a href="http://www.amazon.co.uk/s/?_encoding=UTF8&camp=1634&creative=19450&field-keywords=<?php the_field('amazon_keywords'); ?>&linkCode=ur2&tag=AFFID"> More info Test dynamic Amazon</a>
    <?php else : ?>
            Something else
    <?php endif; ?>

This works and displays the link with the entered keywords.

PROBLEM

Because its an affiliate link, best practice would be to mask it. So instead of showing the affiliate link it shows something like :

website.com/goto/amazon 

Normally this is fine because I can just do a redirect, but the addition of the php inside the URL for the keywords is where I've stumbled.

Anyone have any ideas ?

I'm trying to construct an easy to use affiliate site, each post-type has a custom field where keywords can be entered per post.

Then in a template I call that field into a URL like this :

<?php if( get_field('amazon_keywords') ): ?>
            <a href="http://www.amazon.co.uk/s/?_encoding=UTF8&camp=1634&creative=19450&field-keywords=<?php the_field('amazon_keywords'); ?>&linkCode=ur2&tag=AFFID"> More info Test dynamic Amazon</a>
    <?php else : ?>
            Something else
    <?php endif; ?>

This works and displays the link with the entered keywords.

PROBLEM

Because its an affiliate link, best practice would be to mask it. So instead of showing the affiliate link id like to show it something like :

website.com/goto/amazon 

Normally this is fine because I can just do a redirect, but the addition of the php inside the URL for the keywords is where I've stumbled.

Anyone have any ideas ?

1
source | link

Pass PHP through redirect and custom fields

I'm trying to construct an easy to use affiliate site, each post-type has a custom field where keywords can be entered per post.

Then in a template I call that field into a URL like this :

<?php if( get_field('amazon_keywords') ): ?>
            <a href="http://www.amazon.co.uk/s/?_encoding=UTF8&camp=1634&creative=19450&field-keywords=<?php the_field('amazon_keywords'); ?>&linkCode=ur2&tag=AFFID"> More info Test dynamic Amazon</a>
    <?php else : ?>
            Something else
    <?php endif; ?>

This works and displays the link with the entered keywords.

PROBLEM

Because its an affiliate link, best practice would be to mask it. So instead of showing the affiliate link it shows something like :

website.com/goto/amazon 

Normally this is fine because I can just do a redirect, but the addition of the php inside the URL for the keywords is where I've stumbled.

Anyone have any ideas ?