Title: posts in a line
Last modified: August 19, 2016

---

# posts in a line

 *  Resolved [lucrezia_borgia](https://wordpress.org/support/users/lucrezia_borgia/)
 * (@lucrezia_borgia)
 * [15 years, 4 months ago](https://wordpress.org/support/topic/posts-in-a-line/)
 * Hi!
    I’d like to have posts in lines, rather than one column, let’s say like 
   a table 5×3 (something like this [http://figovina.tumblr.com/](http://figovina.tumblr.com/))
   which function should i put into my loop? or should i do that within css? thanks

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

 *  [esmi](https://wordpress.org/support/users/esmi/)
 * (@esmi)
 * [15 years, 4 months ago](https://wordpress.org/support/topic/posts-in-a-line/#post-1915982)
 * Use CSS and float each of the post blocks left.
 *  Thread Starter [lucrezia_borgia](https://wordpress.org/support/users/lucrezia_borgia/)
 * (@lucrezia_borgia)
 * [15 years, 4 months ago](https://wordpress.org/support/topic/posts-in-a-line/#post-1916134)
 * Thank you, Esmi,
    I’m sorry for probably a stupid question, but how do i designate
   post id withing the loop? should i use some kind of plugin or there is a function
   to it? I have thumbnails to represent posts, and right now the loop looks like
   this:
 * _[Code moderated as per the [Forum Rules](http://codex.wordpress.org/Forum_Welcome).
   Please use the [pastebin](http://wordpress.pastebin.com/)]_
 * so i guess i need id for thumbnails, right? to keep the structure
 * again, i’m sorry, i’m new to all this, but i would really appreciate your help
 *  [esmi](https://wordpress.org/support/users/esmi/)
 * (@esmi)
 * [15 years, 4 months ago](https://wordpress.org/support/topic/posts-in-a-line/#post-1916190)
 * Why do you need to designate post id within the Loop? It’s not essential. All
   you need is a post class so that every post is floated left.
 *  Thread Starter [lucrezia_borgia](https://wordpress.org/support/users/lucrezia_borgia/)
 * (@lucrezia_borgia)
 * [15 years, 4 months ago](https://wordpress.org/support/topic/posts-in-a-line/#post-1916201)
 * basically, it would be easier to visualise if you imagine a table in which each
   cell is a post, right? and my homepage image will take 4 cells (two upper and
   two lower) somewhere in the center of this table. and i dont want it to cover
   my posts, that is why i thought knowing ids of posts would help me to situate
   them wherever i want them to be altogether with homepage image.
    though i understood
   what you mean and am really thankful 🙂
 *  [esmi](https://wordpress.org/support/users/esmi/)
 * (@esmi)
 * [15 years, 4 months ago](https://wordpress.org/support/topic/posts-in-a-line/#post-1916227)
 * You could style on the post ids but that would mean having to adjust the CSS 
   every time you published a new post. Or outputting post id specific CSS via the`
   <head></head>` section of the page – which would be tricky.
 * Four posts (with a computed overall width of 50%) floated left will align in 
   two columns of two.
 *  Thread Starter [lucrezia_borgia](https://wordpress.org/support/users/lucrezia_borgia/)
 * (@lucrezia_borgia)
 * [15 years, 3 months ago](https://wordpress.org/support/topic/posts-in-a-line/#post-1916287)
 * thank you Esmi!
    However manual adjustment is somewhat difficult to maintain.
   anyway, thank you again for sharing ideas 🙂
 *  Thread Starter [lucrezia_borgia](https://wordpress.org/support/users/lucrezia_borgia/)
 * (@lucrezia_borgia)
 * [15 years, 2 months ago](https://wordpress.org/support/topic/posts-in-a-line/#post-1916393)
 * ok, guys. been a while and i figured it out recently. maybe just in case someone
   will need it, the code is:
 *     ```
       <ul class="block1">
   
       	<?php $posts = get_posts ("numberposts=1"); ?>
       	<?php if ($posts) : ?>
       	<?php foreach ($posts as $post) : setup_postdata ($post); ?>
   
       		<li><h2><a href="<?php the_permalink(); ?>" <?php
       if ( has_post_thumbnail() ) { // check if the post has a Post Thumbnail assigned to it.
         the_post_thumbnail();
       }
       ?></a></h2></li>
   
       	<?php endforeach; ?>
       	<?php endif; ?>
   
       </ul>
   
       <ul class="block2">
   
       	<?php $posts = get_posts ("numberposts=1&offset=1"); ?>
       	<?php if ($posts) : ?>
       	<?php foreach ($posts as $post) : setup_postdata ($post); ?>
   
       		<li><h2><a href="<?php the_permalink(); ?>" <?php
       if ( has_post_thumbnail() ) { // check if the post has a Post Thumbnail assigned to it.
         the_post_thumbnail();
       }
       ?>
       </a></h2></li>
   
       	<?php endforeach; ?>
       	<?php endif; ?>
   
       </ul>
       ```
   
 * and so on and so forth.
    where: numberposts=1 tells to display (1) post in a 
   block
 * offset=1 tells to omit previous (1) post
 * <?php if ( has_post_thumbnail() ) { // check if the post has a Post Thumbnail
   assigned to it.
    the_post_thumbnail(); } ?> allows you to use thumbnail instead
   of content and stuff… css is styled to your preferences 🙂

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

The topic ‘posts in a line’ is closed to new replies.

 * In: [Fixing WordPress](https://wordpress.org/support/forum/how-to-and-troubleshooting/)
 * 7 replies
 * 2 participants
 * Last reply from: [lucrezia_borgia](https://wordpress.org/support/users/lucrezia_borgia/)
 * Last activity: [15 years, 2 months ago](https://wordpress.org/support/topic/posts-in-a-line/#post-1916393)
 * Status: resolved

## Topics

### Topics with no replies

### Non-support topics

### Resolved topics

### Unresolved topics

### All topics
