Title: Show Background Between Posts
Last modified: August 19, 2016

---

# Show Background Between Posts

 *  [aldob1](https://wordpress.org/support/users/aldob1/)
 * (@aldob1)
 * [16 years, 3 months ago](https://wordpress.org/support/topic/show-background-between-posts/)
 * I’d like to display the background between posts. In other words, I’d like each
   post to look like a sheet of paper and will style the post. And…in between the
   posts, I would see a few lines where the background would be seen. Does anyone
   know the code to show a gap between posts?
 * Thanks in advance!

Viewing 2 replies - 1 through 2 (of 2 total)

 *  [kz](https://wordpress.org/support/users/kz/)
 * (@kz)
 * [16 years, 3 months ago](https://wordpress.org/support/topic/show-background-between-posts/#post-1367382)
 * 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](https://wordpress.org/support/users/aldob1/)
 * (@aldob1)
 * [16 years, 3 months ago](https://wordpress.org/support/topic/show-background-between-posts/#post-1367544)
 * 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('&laquo; Older Entries') ?></div>
                           <div class="alignright"><?php previous_posts_link('Newer Entries &raquo;') ?></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(); ?>
       ```
   

Viewing 2 replies - 1 through 2 (of 2 total)

The topic ‘Show Background Between Posts’ is closed to new replies.

 * In: [Fixing WordPress](https://wordpress.org/support/forum/how-to-and-troubleshooting/)
 * 2 replies
 * 2 participants
 * Last reply from: [aldob1](https://wordpress.org/support/users/aldob1/)
 * Last activity: [16 years, 3 months ago](https://wordpress.org/support/topic/show-background-between-posts/#post-1367544)
 * Status: not resolved

## Topics

### Topics with no replies

### Non-support topics

### Resolved topics

### Unresolved topics

### All topics
