Custom Fields & If Statements
-
We are generating a shoe review site (http://www.cheapsoccershoes.net) that has multiple affiliate links to check pricing at the bottom of the post. I’m trying to figure out the coding to present the logos of the affiliate store and automatically insert the affiliate link onto the image. In not every case does each store carry the product we are reviewing, so we would have to utilize “if” statements as a check.
ie. if there is a key “soccer_affiliate” then display the logo and insert affiliate link
if there is no “soccer_affiliate” key then nothing would be displayedI’ve read online and think I’m close with this coding, but it doesn’t seem to be working.
<?php
$soccer_affiliate = get_post_meta($post->ID, ‘soccer_affiliate’, true);
if ($link){
echo <img src=”/wp-content/uploads/2009/10/soccer-dot-com-logo.jpg”>;
}
?><?php endwhile; else: ?>
<p></p>
<?php endif; ?>
The topic ‘Custom Fields & If Statements’ is closed to new replies.