用于自定义字段的PHP不';在wordpress中循环后无法工作
我是wordpress上的乞丐,我想在循环后添加带有自定义字段的html,但它不起作用。。。 这是我的密码:用于自定义字段的PHP不';在wordpress中循环后无法工作,php,wordpress,loops,advanced-custom-fields,Php,Wordpress,Loops,Advanced Custom Fields,我是wordpress上的乞丐,我想在循环后添加带有自定义字段的html,但它不起作用。。。 这是我的密码: <section id="jm-categorie-3"> <img class="jm-parallaxe-1" src="<?php the_field('image_parallaxe_1'); ?>" alt="Personnes souriantes"> </section> <?php /* Catégorie
<section id="jm-categorie-3">
<img class="jm-parallaxe-1" src="<?php the_field('image_parallaxe_1'); ?>" alt="Personnes souriantes">
</section>
<?php /* Catégorie 4 - Programme */ ?>
<section id="jm-categorie-4">
<div id="jm-BlocksPinterest" class="jm-programme-global js-masonry" data-masonry-options='{ "columnWidth": 200, "itemSelector": ".item" }'>
<h2><?php the_field('titre_3'); ?></h2>
<?php
// Start the loop
$query = new WP_Query(array('post_type' => 'programme-2015', 'posts_per_page' => -1)) ;
if($query->have_posts()) : while($query->have_posts()) : $query->the_post();
?>
<a class="jm-bloc-programme item" href="<?php the_field('url_programme_2015'); ?>">
<img src="<?php the_field('image_programme_2015'); ?>" alt="<?php the_title(); ?>">
<span></span>
<h3><?php the_title(); ?></h3>
<h4><?php the_field('horaire_programme_2015'); ?></h4>
</a>
<?php // script pour le "Pinterest like blocks"?>
<script src="http://www.blabla.fr/wp-content/themes/test/js/masonry.pkgd.min.js"></script>
<script>
var container = document.querySelector('#jm-BlocksPinterest');
var msnry = new Masonry( container, {
// options
columnWidth: 50,
itemSelector: '.item'
});
</script>
<?php endwhile;endif; // end the loop ?>
</div>
</section>
<?php /* Catégorie 5 - Parallaxe 2 */ ?>
<section id="jm-categorie-5">
<img class="jm-parallaxe-2" src="<?php the_field('image_parallaxe_2'); ?>" alt="">
</section>
“alt=”Personnes souriantes“>
var container=document.querySelector(“#jm BlocksPinterest”);
var msnry=新砌体(容器、{
//选择权
列宽:50,
itemSelector:“.item”
});
“alt=”“>
我的问题是:为什么“section id=“jm-categorie-5”部分中最后一个图像中的“src”没有填充?php_字段('image_parallaxe_2');和代码开头的另一个一样(php_字段('image_parallaxe_1'))?”
在chrome中,它呈现以下内容:
img class=“jm-parallaxe-2”src=”“alt=“”
非常感谢您的帮助!!在自定义查询之后,您需要使用..
wp\u reset\u postdata()
重置postdata。中的详细信息。非常感谢,它对我很有用