• posts are showing in this code but <div class=”index-post”> is not working in first post… But it still working in first onwords. How to modify this code so that <div class=”index-post”> work on the first post also.`<div class=”container”>

    <div class=”container-2″

    <?php
    if(have_posts()) : while (have_posts()) : the_post();
    ?>
    <div class=”index-post”>
    <?php global $url;?>
    <?php $thumb = wp_get_attachment_image_src( get_post_thumbnail_id($post->ID), ‘post_thumb’ );
    $url = $thumb[‘0’]; ?>

    <?php if( has_post_thumbnail() ){ ?><div class=”index-post-thumbnail” style=”background-image: url(<?php echo $url; ?>) “> </div><?php } ?>

    <div class=”index-post-title”><h2><a href=”<?php the_permalink() ?>” rel=”bookmark”><?php the_title() ?></a></h2></div>

    <p class=”post-info”> <?php the_time(‘F jS, Y, g:i a’) ?> | by <a href=”#”><?php the_author()?> </a> | posted in <a href=”#”><?php the_category(); ?></a></p>

    <div class=”index-post-excerpt”><?php the_excerpt(); ?></div>
    </div>
    <?php
    endwhile; endif;
    ?>
    </div>
    </div>
    `

The topic ‘problem in looping’ is closed to new replies.