WordPress.org

Ready to get started?Download WordPress

Forums

fallback image only showing on first fallback location but none after (1 post)

  1. andrewtoohill
    Member
    Posted 1 year ago #

    So here is my test site:

    click here

    I am trying to have a fallback image for featured post locations so in case there is no featured image selected then there is a fallback. I got this working in the featured slider but it only shows the fallback image in the first location that a featured post is missing but none of the ones after that. Note the third and fourth slides should show it but do not.

    Here is my code

    <?php $slide_query = new WP_Query('category_name=featured&showposts=10'); ?>
                         <?php while ($slide_query->have_posts()) : $slide_query->the_post(); ?>
                            <li class="default" >
                               <a href="<?php the_permalink() ?>" class="post-link">
    
                                  <?php if ( has_post_thumbnail()) {
                                     the_post_thumbnail('thumbnail', array('class' => 'pull-right'));
                                     } else { ?>
                                     <img src="<?php echo CHILD_URL; ?>/library/images/featured-filler1.png" alt="<?php the_title(); ?>" class="fillerimg" />
                                  <?php } ?>  
    
                               </a>
                             <h3><a href="<?php the_permalink() ?>" title="<?php the_title() ?>"><?php the_title() ?></a></h3>
                             <h5 class="post-info">Posted on <span class="date"><?php the_date(); ?></span> under <?php the_category(', '); ?></h5>
                             <p><?php the_excerpt(); ?></p>
                             <a href="<?php the_permalink() ?>" class="read-more">Read More</a>
                             <div class="pull-right comment-link"><a href="<?php the_permalink(); ?>#respond"rel="tooltip" title="<?php
                               $commentcount = comments_number( 'Leave a comment', '1 Comment', '% Comments' );
                               ?>"><img src="<?php echo CHILD_URL; ?>/library/images/comment.png"></a></div>
                            </li>
                         <?php endwhile; ?>

Topic Closed

This topic has been closed to new replies.

About this Topic