私はバックエンドからの情報検索で何が問題になっているのか疑問に思っていました。 (前にこのような問題はなかった)Wordpress ACFはフィールド情報を取得しません
私は、get_template_part()のpartialsで構成される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項目の情報は取り出されません。
インデックス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>
(リピータフィールドに)インデックスservices.phpの全てのリンクを追加
Image of retrieved HTML of get_template_part()
彼の問題は、それらのthe_field()関数のどれもがバックエンドから情報を取得していないということです。私は、バックエンドでのフィールドを設定している
はインデックスとしてページに示される(そして、彼らは、示さ満たされている)
は、私は、クエリループに問題を持っていますか?
多分あなたはそれを説明する時間がありますか? –
<?php global $ wp_query; echo $ wp_query-> post-> ID; ?> あなたはこれを提案しますか? –
申し訳ありませんが、コードを引用するのを忘れてしまった。だから私の答えは、上記のコードを参照してください – Omnisite