【发布时间】:2017-02-02 20:55:34
【问题描述】:
我想知道从后端检索信息时遇到了什么问题。 (从来没有遇到过这样的问题)
我制作了一个由 get_template_part() 部分组成的 index.php。 成为
<?php get_header(); ?>
<?php get_template_part( 'partials/index', 'slider' );
get_template_part( 'partials/index', 'services' );
get_template_part( 'partials/index', 'work' );
get_template_part( 'partials/index', 'testimonials' );
get_template_part( 'partials/index', 'recent' );
get_template_part( 'partials/index', 'technologies' );
get_template_part( 'partials/index', 'contact' ); ?>
<?php get_footer(); ?>
所有这些模板部分都包含了自己的 html+php。 它从这些部分中检索所有 HTML,但不检索 ACF 字段上的信息。
“partials”文件夹中的 index-services.php 示例:
<section id="services">
<div class="container">
<div class="row">
<div class="col-lg-12 text-center">
<div class="title">
<h1 class="section-heading text-uppercase">
<?php the_field('service_section_title'); ?>
</h1>
<p class="text-faded">
<?php the_field('service_section_description'); ?>
</p>
<div class="btn btn-primary btn-sm">
<a href="<?php the_field('service_section_button_link'); ?>">Learn more</a>
</div>
</div>
</div>
</div>
</div>
添加index-services.php的所有链接(带repeater字段)
Image of retrieved HTML of get_template_part()
问题是,这些 the_field() 函数都没有从后端检索信息。
我已将后端字段设置为在页面中显示为索引(并且显示、填充)
我是否遇到了查询循环问题?
【问题讨论】:
标签: php wordpress wordpress-theming advanced-custom-fields