如何显示表格中的Wordpress自定义页面的_meta()
我需要在表格中显示我的WordPress自定义页面上的一些元值。有什么办法可以做到这一点。如何显示表格中的Wordpress自定义页面的_meta()
这是我现在使用的代码:<?php the_meta(); ?>
而这正是它表明:
我想要做的事,如:
我发现:
the_meta()位于WP-包括/-的template.php后
这使得输出:
<ul class='post-meta'>
<li><span class='post-meta-key'>your_key:</span> your_value</li>
</ul>
所以不建议因为该文件夹中编辑文件wordpress更新。
<table>
<tr><td colspan="2">Game Summary</td></tr>
<?php
$meta = get_post_meta(get_the_ID());
$exclude = array('_edit_last', '_wp_page_template', '_edit_lock');
foreach($meta as $key => $value) {
if(in_array($key, $exclude))
continue;
?>
<tr>
<td><?php echo $key; ?></td>
<td><?php echo $value[0]; ?></td>
</tr>
<?php
}
?>
</table>
感谢您的帮助!键出现,但不显示值,它显示“数组”。 – Frankolin
替换下面的表格: – Subharanjan
它工作? http://meta.stackexchange.com/a/5235 – Subharanjan
你的代码是非常有帮助的。谢谢! – Frankolin