0
我在博客上的4個地方使用自定義字段。我在高級自定義字段中輸入了默認值,但沒有打印。高級自定義字段值未顯示
<?php
global $formTitle;
global $formSubtitle;
global $formBackground;
$formTitle = get_post_custom_values('title');
$formSubtitle = get_post_custom_values('description');
if (!$formBackground):
$formBackground = 'contact-form--background';
endif;
$portalId = get_post_custom_values('portalid');
$formId = get_post_custom_values('formid');
?>
<div id="cta__contactForm" class="contact-form <?= $formBackground ?>">
<div class="page-width text-center">
<h4 class="contact-form__header"><?= $formTitle ?></h4>
<p class="contact-form__subheader"><?= $formSubtitle ?></p>
<!--[if lte IE 8]>
<script charset="utf-8" type="text/javascript" src="//js.hsforms.net/forms/v2-legacy.js"></script>
<![endif]-->
<script charset="utf-8" type="text/javascript" src="//js.hsforms.net/forms/v2.js"></script>
<script>
// Blog form
hbspt.forms.create({
css: '',
portalId: <?php $portalId?>,
formId: <?php $formId?>
});
</script>
</div>
</div>