我必须在下面的代码中将内容发布为html,您可以看到div <div class='pbg_info'
我希望使用$post->post_content="
和任何其他方式发布为html
div class&#39; pbg_info&#39;是组付款网关的付费脚本,用于显示付款组按钮。
如果有人知道如何实现这一点,请告诉我。
$post->post_content="
<div class='pbg_info'
data-purchase-image-url='http://example.com/picture.png'
data-purchase-name='Awesome Escape'
data-purchase-inventory-id='ESCAPE-23'
data-purchase-cost='"<?php echo $price;" ?>'
data-purchase-currency='CAD'
data-purchase-link-url='http://example.com/property'
data-purchase-description='Great rental for 3 people with lake view.' >
</div>
<script src='https://cdn.paybygroup.com/snippet/v2/loader.js?merchant_id=example'>
</script>";
使用此代码我得到这样的输出。我希望使用此代码在此处显示一个按钮。
data-purchase-image-url=’http://example.com/picture.png’
data-purchase-name=’Awesome Escape’
data-purchase-inventory-id=’ESCAPE-23′
data-purchase-cost=’100′
data-purchase-currency=’CAD’
data-purchase-link-url=’http://example.com/property’
data-purchase-description=’Great rental for 3 people with lake view.’ >
答案 0 :(得分:3)
我认为您必须在输出之前过滤该内容,这意味着您必须使用如下代码:
<?php
$content=$post->post_content;
echo apply_filters('the_content', $content);
?>