Fallback for empty custom fields

You could do it like this: // store post meta in a variable and use that so you aren’t pulling the post meta data twice $landPricing = get_post_meta($post->ID, “Pricing_Land_Only”, true) if(!empty($landPricing)) { echo $landPricing; } else { echo “Sorry, nothing was found.”; }

Custom field to array?

I will assume that you(or users) will enter post ids into a posts custom field, comma separated, eg: 11,13,34,54 OR 11, 13, 34, 54. Then all you need to do is get the custom field value for the loaded post, explode the custom field value by comma(,): and, then you’ll have a nice array to … Read more

custom comment_form fields not displaying

I think you’re a bit confused about how comment_form works. So let’s take a look (this is in wp-includes/comment-template.php): <?php function comment_form( $args = array(), $post_id = null ) { // snip snip $fields = array( ‘author’ => ‘<p class=”comment-form-author”>’ . ‘<label for=”author”>’ . __( ‘Name’ ) . ‘</label> ‘ . ( $req ? ‘<span … Read more

Using a string from a custom field within a link

Change, <?php $email ?> to… <?php echo $email; ?> as you need to echo the result of what’s held within $email as the function types_render_field would be using return within the function (if you dig into its core) to return the data instead of directly printing it to screen. <?php $email = types_render_field (“email”); if … Read more

Automatic linking terms

The answer was right under my nose facepalm. In the custom field suite plugin, instead of entering ProductName-2000 : ProductName-2000 you enter <a href=”http://www.site.com/ProductName-2000/”>ProductName-2000</a> : ProductName-2000 I kinda wish i could delete this question… hope it helps someone else at least. 😛