在自定义字段中包含HTML标签 [英] Include HTML tags in custom fields

查看:111
本文介绍了在自定义字段中包含HTML标签的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我的WordPress博客文章中有一个当前正在阅读的自定义字段,我想将其包装在HTML标记中输出。

I have a "currently reading" custom field in my WordPress blog post, and I want to output it wrapped in an HTML tag.

我尝试过的是这种黑客攻击:

What I tried was this hack:

echo "<h1>" . $mycustomfieldcontent . "</h1>";

客户端更喜欢做的是能够在实际的自定义中设置HTML 字段

What the client prefers to do is to be able to set the HTML in the actual custom field.

执行该操作的正确方法是什么?

What would be the proper way to do that?

推荐答案

您已关闭。与您之前的问题几乎相同,请参见屏幕截图:

You're close. Pretty much the same as your previous question, see the screenshots:

添加包含HTML的自定义字段。

Add your Custom Field with HTML in it.

然后用以下命令显示它:

Then display it with this:

<?php echo get_post_meta($post->ID, 'Your Meta Key', true); ?>

输出应该是:

这篇关于在自定义字段中包含HTML标签的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆