我有这个代码:
onAttach
但结果是这样的:
foreach ($ck as $k) {
if (substr ($k, 0, 1) == '_')
{ // skip keys starting with '_'
continue;
}
$cv = get_post_custom_values($k, $post_id ); //Array
foreach ($cv as $c) {
if (empty ($c))
{ // skip empty value
continue;
}
$format_c = $c;
print_r ('<div style="font-size: 14px;">'.$k .': '. $format_c . ' / </div>');
}
}
?>
如何更改代码:
something: result /
something: result /
something: result /
谢谢!
答案 0 :(得分:1)
<div>
是块级元素。请使用内联元素,例如<span>
。
foreach ($ck as $k) {
if (substr ($k, 0, 1) == '_')
{ // skip keys starting with '_'
continue;
}
$cv = get_post_custom_values($k, $post_id ); //Array
foreach ($cv as $c) {
if (empty ($c))
{ // skip empty value
continue;
}
$format_c = $c;
echo "<span style='font-size: 14px;'>$k: $format_c / </span><br/>";
}
}
?>
答案 1 :(得分:0)
foreach ($ck as $k) {
if (substr ($k, 0, 1) == '_')
{ // skip keys starting with '_'
continue;
}
$cv = get_post_custom_values($k, $post_id ); //Array
echo '<div style="display: inline; font-size: 14px;">';
foreach ($cv as $c) {
if (empty ($c))
{ // skip empty value
continue;
}
$format_c = $c;
print_r ($k .': '. $format_c . ' /);
}echo '</div>';
}
&GT;