2016-03-01 29 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

請添加一些解釋。目前,您的答案被標記爲「低質量」,可能會被刪除。 –

相關問題