Include HTML tags in custom fields

戏子无情 提交于 2019-12-24 13:16:12

问题


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>";

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?


回答1:


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

Add your Custom Field with HTML in it.

Then display it with this:

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

And the output should be:



来源:https://stackoverflow.com/questions/19055672/include-html-tags-in-custom-fields

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!