0
我已經安裝了一個高級自定義字段插件來上傳音頻和圖像文件。每個帖子包含5場如何從模板頁面的數據庫獲取字段值高級自定義字段 - wordpress
我可以能夠發表這篇文章,但我不知道如何在WordPress模板頁面
我已經安裝了一個高級自定義字段插件來上傳音頻和圖像文件。每個帖子包含5場如何從模板頁面的數據庫獲取字段值高級自定義字段 - wordpress
我可以能夠發表這篇文章,但我不知道如何在WordPress模板頁面
你可以做這樣的事情
<?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/
只需撥打同場的名稱此功能在你的模板文件
<?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;
?>
請添加一些解釋。目前,您的答案被標記爲「低質量」,可能會被刪除。 –