Help me troubleshoot short Loop. It works, almost.
-
I think this is *mostly* right. It should give me three boxes containing some custom fields. The first two are fine, but the third one ends up really weird. I think this is a simple matter of getting things in the right place.
Here’s the code:
<div id="promos" class="clearfix">
<?php if (have_posts("category=22&number=3")) : ?>
<?php while (have_posts()) : the_post(); ?>
<div class="promoitem">
<?php echo get_post_meta($post->ID, 'Feature promo image', true); ?>
<h2><?php echo get_post_meta($post->ID, 'Feature promo header', true); ?></h2>
<p><?php echo get_post_meta($post->ID, 'Feature promo text', true); ?></p>
</div>
<?php endwhile; ?></div>
<?php endif; ?>And here’s the output:
<div id="promos" class="clearfix">
<div class="promoitem">
<img src="/images/grohl_72.jpg" alt="Grohl" /><h2>Foo Fighters rock Va.</h2>
<p>This is text this is text this is text this is text lorem ipsum dolor sit amet This is text this is text this is text this is text lorem ipsum dolor sit ame ipsum dolor.</p>
</div>
<div class="promoitem">
<img src="/images/demondays.jpg" alt="Gorillaz"<h2>New Gorillaz album</h2>
<p>This is text this is text this is text this is text lorem ipsum dolor sit amet This is text this is text this is text this is text lorem ipsum dolor sit ame ipsum dolor.</p>
</div>
<div class="promoitem">
<h2></h2>
<p></p>
</div>
<div class="promoitem">
<h2></h2>
<p></p>
</div>
<div class="promoitem">
<h2></h2>
<p></p>
</div>
<div class="promoitem">
<img src="/images/deltron3030.jpg" alt="Deltron 3030" /><h2>Automator is God</h2>
<p>This is text this is text this is text this is text lorem ipsum dolor sit amet This is text this is text this is text this is text lorem ipsum dolor sit ame ipsum dolor.</p>
</div>
<div class="promoitem">
<h2></h2>
<p></p>
</div>
<div class="promoitem">
<h2></h2>
<p></p>
</div>
<div class="promoitem">
<h2></h2>
<p></p>
</div></div>
- The topic ‘Help me troubleshoot short Loop. It works, almost.’ is closed to new replies.