Custom Fields

Tuesday, August 7th, 2007 | Sites

I’m discovering WordPress’s Custom Fields. They are absolutely fabulous to build filmography pages! Once the hard work but then one has a template that can be used over and over again!! However, I’m really not good at coding php strings.

Does anybody know what I need to add to the following code to get it to return the words without the link (Official site) if there is no value?

<a href=”<?php echo get_post_meta($post->ID, “Photo Gallery”, $single = true); ?>”>Photo Gallery</a><br /> 

The following gives me an error. [edit:] I figured it out in case someone is interested:
<?php
$values = get_post_meta($post->ID, “Photo Gallery”, $single = false);
if ( is_array($values) ) { ?>
 <a href=”<?php echo $values[0]; ?>”>Photo Gallery</a>
<?php } else { ?>
 <?php echo ‘Photo Gallery’; ?>
<?php } ?><br />

No comments yet.

Leave a comment

Radio.Blog

Meta

Search