Display WordPress archive template page in 3 columns and not 1 column

The question:

I’m trying to achieve the following:

Display WordPress archive template page in 3 columns and not 1 column

Currently WordPress display them in 1 column:

Display WordPress archive template page in 3 columns and not 1 column

Is there code I can Add to the template file, to display all the blog post in this grid layout

The Solutions:

Below are the methods you can try. The first solution is probably the best. Try others if the first one doesn’t work. Senior developers aren’t just copying/pasting – they read the methods carefully & apply them wisely to each case.

Method 1

Without knowing the structure, class names, ids etc. it would be impossible to give you an answer that would help.

But lets say that the structure is ul>li*6

<ul>
    <li>...</li>
    <li>...</li>
    <li>...</li>
    <li>...</li>
    <li>...</li>
    <li>...</li>
</ul>

The must basic of css that would create such a design would be

ul {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    grid-gap: 20px 50px;
}

You would need to adjust the gap im sure, but this is a good starting point

EDIT

Ok so following your answer with the image the css target would be .page-content, but that could target other elements with the same class.

Try looking for a parent with a unique class or id that you can use to make sure your css only target that specific element


All methods was sourced from stackoverflow.com or stackexchange.com, is licensed under cc by-sa 2.5, cc by-sa 3.0 and cc by-sa 4.0

Leave a Comment