[英]how to get field values from database in template page Advanced Custom Fields - wordpress
只需使用模板文件中的字段名稱調用此函數
<?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;
?>
你可以做這樣的事情
<?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/
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.