0

The site I am working on is skinnnybantonmusic.com The Lastest News page is suppost to show the blog posts but for some reason none are showing up. (http://www.skinnybantonmusic.com/latest-news/)

<?php get_header(); ?>

<div id="main">

    <?php if (have_posts()) : while (have_posts()) : the_post(); ?>

        <div <?php post_class() ?> id="post-<?php the_ID(); ?>">

        <?php if ( has_post_thumbnail() ) : ?>
            <a href="<?php the_permalink(); ?>">
                <?php the_post_thumbnail(); ?>
            </a>
        <?php endif; ?>

        </div>

    <?php endwhile; ?>

    <?php include (TEMPLATEPATH . '/inc/nav.php' ); ?>

    <?php else : ?>

        <h2>Not Found</h2>

    <?php endif; ?>

</div><!--Main End-->

<?php get_footer(); ?>
0

The reason is that its not showing up

 <?php if ( has_post_thumbnail() ) : ?>
        <a href="<?php the_permalink(); ?>">
            <?php the_post_thumbnail(); ?>
        </a>
 <?php endif; ?>

You are displaying just a link with check that is featured image exists or not

It seems, your post doesn't have featured image, select any featured image or just remove that check from it, as i can't see any need of it.

So your code will be :

<?php get_header(); ?>
<div id="main">
    <?php if (have_posts()) : while (have_posts()) : the_post(); ?>
        <div <?php post_class() ?> id="post-<?php the_ID(); ?>">
            <a href="<?php the_permalink(); ?>">
                <?php the_post_thumbnail(); ?>
            </a>
        </div>
    <?php endwhile; ?>
    <?php include (TEMPLATEPATH . '/inc/nav.php' ); ?>
    <?php else : ?>
        <h2>Not Found</h2>
    <?php endif; ?>
</div><!--Main End-->
<?php get_footer(); ?>
0

Yes if you want to show thumbnail in that case you need to change this code and remove if condition and use the_post_thumbnail(); directly.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.