Adding get meta data to a loop
-
If I add either of the following statments in the loop it works out OK
echo get_post_meta($post->ID, 'phone', true); $key2="phone"; echo get_post_meta($post->ID, $key2, true);
If I add this in the same place it goes pear-shaped and gives me an error: syntax error, unexpected T_VARIABLE, expecting ‘,’ or ‘;’
$phone = get_post_meta($post->ID, 'phone', true); if ($phone) { echo '<div class="sideBox">'$phone'</div>'; }
Can someone please try and tell me why the second option doesn’t work. I guess you can see that I want to call this custom field meta data but wrap it in some HTML
Thanks
Martin
Viewing 3 replies - 1 through 3 (of 3 total)
Viewing 3 replies - 1 through 3 (of 3 total)
- The topic ‘Adding get meta data to a loop’ is closed to new replies.