Adding Link to php conditional
-
I have the following code in my loop.
foreach(get_post_custom_values('post_image') as $value) { echo '<img src="/images/' . $value . '.jpg" width="240" height="60" alt="" />'; } else : echo '<img src="/images/imagenotfound.jpg" width="240" height="60" alt="" />'; endif; ?>
I am having a hard time making the image a link because of quotes vs. double quotes and my ability to call the permarlink function built into wordpress. If I use a single quote:
<a href='<?php get_permalink(); ?>'>
I get parse erros. If I use double quotes:<a href="<?php get_permalink(); ?>">
the php doesn’t translate.I realize my problem is in that i’ve already initiate php, but I can’t figure out how to do it. Could someone help me.
The simple form of the question is this: How can I turn the results of my custom value query into a link?Thanks.
Viewing 3 replies - 1 through 3 (of 3 total)
Viewing 3 replies - 1 through 3 (of 3 total)
- The topic ‘Adding Link to php conditional’ is closed to new replies.