WordPress.org

Ready to get started?Download WordPress

Forums

How to? Display category posts in 2 colums (3 posts)

  1. marksurf
    Member
    Posted 3 years ago #

    Hi,

    I have been searching around for a piece of code to display my category posts in 2 columns. Is this possible?

    So the result of archive.php would be:

    post 1 | post 2
    post 3 | post 4
    post 5 | post 6

    this is my current page
    http://www.fitness-winkel.com/category/techno/

    Thanks for the help

  2. marksurf
    Member
    Posted 3 years ago #

  3. gr1zzly
    Member
    Posted 3 years ago #

    How are you with CSS? In styles.css try:

    .post {
    border-left:1px solid #ddd;
    float:left;
    padding:0 12px;
    width:50%;
    }
    
    .post:nth-child(odd) {
    border-left:none;
    }

    I haven't tested this but off the top of my head this should give you two posts side by side with a faint grey line in between them. The padding makes sure that there is a gap between the content of the post and the line, while the second rule prevents the left hand side posts from also having a left border.

    Of course you could add whatever styling you want with CSS, if you'd prefer not to have a vertical border between the posts etc.

    This is most likely the easiest way without customising a template file for this purpose. Hopefully it should at least get you somewhere near.

    If your not sure how to edit styles.css:
    You can access styles.css in the admin panel's theme editor, just select the file from the right hand list, scroll to the bottom of the file and paste the code there.

    Worst comes to worst and my code doesn't work simply edit the file again and delete what you just pasted!

    hth

Topic Closed

This topic has been closed to new replies.

About this Topic