[Resolved] Split Category posts in three columns
I’ve been searching for a way to split the latest 15 posts from one specific category, into three columns (contaning 5 items each) and display it as links?
I know that people have shown a way to split ALL CATEGORIES into a number of columns, but that’s not what I’m after here.
I have two categories (Music, Food) with 20 posts in each. So, for the music-page i would like to show the last 15 from the music category and vice versa for the Food-page.
Post 1 Post 6 Post 11
Post 2 Post 7 Post 12
Post 3 Post 8 Post 13
Post 4 Post 9 Post 14
Post 5 Post 10 Post 15
I’m currently displaying them like this:
<ul> <?php global $post; $myposts = get_posts('numberposts=15&category=1'); foreach($myposts as $post) : setup_postdata($post); ?> <li><a href="<?php the_permalink(); ?>"><?php the_title(); ?></a></li> <?php endforeach; ?> </ul>
But it will only give you a long list…and that’s ugly 🙂
Any help would be greatly appreciated!
- The topic ‘[Resolved] Split Category posts in three columns’ is closed to new replies.