Title: Loop Posts in HTML Table
Last modified: August 20, 2016

---

# Loop Posts in HTML Table

 *  [theMaab](https://wordpress.org/support/users/themaab/)
 * (@themaab)
 * [13 years, 4 months ago](https://wordpress.org/support/topic/loop-posts-in-html-table/)
 * I’m looking to loop some posts in an HTML Table. I have this working, but my 
   problem is I need to swap the columns for rows.
 * My current table looks like this:
    Title:1 | Field:1A | Field:1B Title:2 | Field:
   2A | Field:2B Title:3 | Field:3A | Field:3B
 * But I need it to look like this:
    Title:1 | Title:2 | Title:3 Field:1A | Field:
   2A | Field:3A Field:1B | Field:2B | Field:3B
 * With the way my current loop (query_posts) is my posts are turning into rows,
   but I need them as columns.
 * Any help greatly appreciated!

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

 *  [Michael](https://wordpress.org/support/users/alchymyth/)
 * (@alchymyth)
 * [13 years, 4 months ago](https://wordpress.org/support/topic/loop-posts-in-html-table/#post-3377748)
 * it might be easier to use up-to-date divs or nested tables;
 * however, what you want should also be possible;
 * to start, please post the code of your loop or better the full tempalte – please
   use the pastebin [http://codex.wordpress.org/Forum_Welcome#Posting_Code](http://codex.wordpress.org/Forum_Welcome#Posting_Code)
 *  Thread Starter [theMaab](https://wordpress.org/support/users/themaab/)
 * (@themaab)
 * [13 years, 4 months ago](https://wordpress.org/support/topic/loop-posts-in-html-table/#post-3377776)
 * Hi alchymyth, Thanks for your reply!
 * I was using a shortcode function I modified to show a table from digwp:
    [http://digwp.com/2010/01/custom-query-shortcode/](http://digwp.com/2010/01/custom-query-shortcode/)
 * My version: [http://pastebin.com/MERTHeRh](http://pastebin.com/MERTHeRh)
 * I did try an up-to-date div version: [http://pastebin.com/qewCibsm](http://pastebin.com/qewCibsm)
 * But knew I would have to do a lot of styling to make the table look right. The
   heights of the cells and such would require a bit of tweaking.
 * The nested tables is another good idea I didn’t think of.
    I also thought to 
   first loop the posts and store them in an array, which I could then loop over
   it to get the columns I’m needing. It’s a bit more overhead, but there should
   only be about 10 columns (posts) in this query.

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

The topic ‘Loop Posts in HTML Table’ is closed to new replies.

## Tags

 * [loop](https://wordpress.org/support/topic-tag/loop/)

 * 2 replies
 * 2 participants
 * Last reply from: [theMaab](https://wordpress.org/support/users/themaab/)
 * Last activity: [13 years, 4 months ago](https://wordpress.org/support/topic/loop-posts-in-html-table/#post-3377776)
 * Status: not resolved

## Topics

### Topics with no replies

### Non-support topics

### Resolved topics

### Unresolved topics

### All topics
