2016-03-01 59 views

回答

0

你可以做这样的事情

<?php if (have_posts()) : while (have_posts()) : the_post(); ?> 
    <h1><?php the_field('main_content_heading'); ?></h1> 
<?php endwhile; endif; ?> 

在循环中,使用the_field方法输出自定义字段。

在这里看到更多的细节:http://www.advancedcustomfields.com/resources/code-examples/

1

只需拨打同场的名称此功能在你的模板文件

<?php 
while (have_posts()): the_post(); 
     // Display post 
     if (have_posts()):?> 
     <?php echo the_field('slider_name');?> 
    <?php echo the_field('slider_description'); 

endif; 
endwhile; 
?> 
+0

请添加一些解释。目前,您的答案被标记为“低质量”,可能会被删除。 –

相关问题