Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
conditional tag - show custom field only if has value?
#1
Hi there!

Has anybody an idea how to get content only be shown as custom field has value?

e.g: I am using GS Blog Custom Fields, I have a custom field calles "pic1"

I want to have some images within a class like:

<img class="thumbnail" src="<?php echo $post->pic1; ?>" width="100" height="80" alt="" title="" />

But if theres no custom field value I don't want to have the class and stuff to be loaded.

I tried something like this:

<?php if ($post->pic1, TRUE) { ?> <img class="thumbnail" src="<?php echo $post->pic1; ?>" width="100" height="80" alt="" title="" /> <?php } ?>

But this doesn't work...any suggestions?

Thank you!

AD
Reply


Messages In This Thread
conditional tag - show custom field only if has value? - by ad2003 - 2012-11-23, 19:52:53



Users browsing this thread: 1 Guest(s)