Add gap DIVs between the posts like this:
<?php
$first = true;
if(have_posts()) :
while(have_posts()) :
the_post();
if($first) :
$first = false;
?>
<div class="gap"><!--//--></div>
<?php endif; ?>
<div <?php post_class(); ?> id="post-<?php the_ID(); ?>">
<h2><a href="<?php the_permalink(); ?>"><?php the_title(); ?></a></h2>
<div class="entry">
<?php the_content() ?>
</div>
</div>
<?php
endwhile;
endif;
?>
And add gap’s rule in style.css like this:
.gap{
height:30px;
background:url(images/my-background.png} center center no-repeat;
}
Thread Starter
aldob1
(@aldob1)
Here is the code that I’m using. I’ve added the style. Can you inset the code because I can’t get it to work as desired. Maybe I’m doing something wrong.
<?php get_header(); ?>
<div id="content">
<?php if (have_posts()) : ?>
<?php while (have_posts()) : the_post(); ?>
<div class="title">
<h2><a href="<?php the_permalink(); ?>"><?php the_title(); ?></a></h2>
<span><?php the_time('F j, Y') ?></span>
</div>
<!-- entry start -->
<div class="entry">
<?php the_content(''); ?>
<!-- recent comment of each post -->
<div class="recent-comment">
<?php
$comment_array = array_reverse(get_approved_comments($wp_query->post->ID));
$count = 1;
?>
<?php if ($comment_array) { ?>
<span class="comment"> <?php comments_number('No comment','1 comment','% comments'); ?></span> - Latest by:
<ul class="commentlist">
<?php foreach($comment_array as $comment){ ?>
<?php if ($count++ <= 2) { ?>
<li><?php comment_author_link(); ?> <br /> <?php comment_excerpt(); ?> </li>
<?php } ?>
<?php } ?>
</ul>
<?php } else { ?> <!-- if there was no comment in that post,yet -->
<span class="comment">No comment so far</span>
<?php } ?>
</div>
<!-- end recent comment-->
</div>
<!-- entry end -->
<p class="postmetadata center">
<?php the_tags('Tags: ', ', ', '<br />'); ?> Posted in <?php the_category(', ') ?> |<!-- <?php edit_post_link('Edit', '', ' | '); ?> -->
<?php comments_popup_link('No Comments »', '1 Comment »', '% Comments »'); ?>
</p>
<?php endwhile; ?>
<div class="navigation">
<div class="alignleft"><?php next_posts_link('« Older Entries') ?></div>
<div class="alignright"><?php previous_posts_link('Newer Entries »') ?></div>
</div>
<?php else : ?>
<h2 class="center">Not Found</h2>
<p class="center">Sorry, but you are looking for something that isn't here.</p>
<?php get_search_form(); ?>
<?php endif; ?>
</div>
<?php get_footer(); ?>