我是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 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>
我的问题是:为什么&#34; src&#34;在第34页的最后一张图片中;节ID =&#34; jm-categorie-5&#34;并没有填充&#34;?php the_field(&#39; image_parallaxe_2&#39;);就像代码开头的另一个一样(php the_field(&#39; image_parallaxe_1&#39;);)?&#34;
在chrome中,它呈现:
img class =&#34; jm-parallaxe-2&#34; SRC =&#34;&#34; ALT =&#34;&#34;
非常感谢你的帮助!!