好的,所以在 Wordpress 大师的帮助下,我有一个答案:
<?php $page_contid = 921;
$newpost = pll_get_post($page_contid);
?>
<div class="section-contacts" style="background: <?php echo the_field('contact-section-color', $newpost);?>">
<div class="container">
<div class="section-info">
<div class="section-info_contacts">
<div class="heading"><?php echo the_field('contact-section-heading1', $newpost);?></div>
<div class="item">
<img src="<?php echo the_field('contact-section-address_img', $newpost);?>" alt="">
<p><?php echo the_field('contact-section-address', $newpost);?></p>
</div>
<div class="item">
<img src="<?php echo the_field('contact-section-email_img', $newpost);?>" alt="">
<p><a href="<?php echo the_field('contact-section-email', $newpost);?>"><?php echo the_field('contact-section-email', $newpost);?></a></p>
</div>
<div class="item">
<img src="<?php echo the_field('contact-section-phone_img', $newpost);?>" alt="">
<div class="item-numbers">
<p><a href="<?php echo the_field('contact-section-phone1', $newpost);?>"><?php echo the_field('contact-section-phone1', $newpost);?></a></p>
<p><a href="<?php echo the_field('contact-section-phone2', $newpost);?>"><?php echo the_field('contact-section-phone2', $newpost);?></a></p>
</div>
</div>
</div>
由于我使用 polylang,我将页面 id 提交给 polylang 的 pll_get_post,它会找到另一种语言的帖子,然后我将该页面 id 变量添加到每个 acf 字段 acho 的末尾,作为另一个参数。然后我将此页面添加为其他页面的包含,它可以工作!!!