I have a function:
?php function my_post_meta ($post, $field) {
$value = get_post_meta ($post->ID, $field, true);
if ($value !== "") {
return $field . " " . $value . "<br />";
} else return "";
} ?>
The idea is that I print $field and $value somewhere down the line, but I need to have $field formatted as part of
<span class="post-meta-key">
and I need to have $value formatted as part of
<span class="post-meta">
with the requisite closed tags.
I do not know what I am doing at all, I had someone walk me through defining the function with my hand close in his. But I've tried every combination of "<span>", . " s, and so on, but I get an unexpected T_STRING each time, for example:
<?php function my_post_meta ($post, $field) {
$value = get_post_meta ($post->ID, $field, true);
if ($value !== "") {
return "<span class="meta-post-key>" . $field . " " . $value . "<br />";
} else return "";
} ?>
I know it's bad because the syntax isn't the right color, but I haven't been able to teach myself the proper syntax. I've never been much of an autodidact. :o