It’s wasteful and inefficient to make multiple queries when one will do. If you add a loop counter, you can alter HTML when the count reaches certain levels, all with one query. For example, lets say there are 11 posts per page. When count==0, do HTML for a large hero post. At count==1 start HTML for the first column. At count==6, close the first column HTML and start second column. At count==10 close the second column.
The problem with multiple columns is the lengths are difficult to closely match, even with excerpts. One solution is to set post heights to a fixed value so any extra space is distributed among the posts. Or simply output all the posts in a grid format and use jQuery’s Masonry library to get them to nicely fit together.
Any algorithm you decide upon is going to result in the same layout on every page. The only way to avoid that is to use a different algorithm for different pages.
Hi, I’ve done it with: nth-child. This is the code that I used in case it works for you.
/ ************************************************* **********
******************** BLOG ***************************** ****
************************************************** ********* /
.container {
width: 80%;
margin: 0 auto;
}
article.blog {
}
h2.entry-title a {
color: black;
}
.list-entries article: nth-child (1) {
min-width: 100%! important;
margin-top: .5rem;
}
.list-entries article: nth-child (1) img {
padding: 1em 3em;
margin: 1em;
}
.list-entries article: nth-child (2) {
max-width: 33%! important;
}
.list-entries article: nth-child (2) img {
min-width: 33%! important;
}
.list-entries article: nth-child (3) {
min-width: 66%! important;
}
.list-entries article: nth-child (3) img {
min-width: 66%! important;
}
.list-entries article: nth-child (4) {
max-width: 66%! important;
}
.list-entries article: nth-child (5) {
max-width: 33%! important;
}
article.blog {
max-width: 49%;
margin: 0 car;
background-color: # 0073aa;
border-radius: 10px 10px 10px 10px;
-moz-border-radius: 10px 10px 10px 10px;
-webkit-border-radius: 10px 10px 10px 10px;
border: 0px solid # 000000;
padding: .2rem;
margin-bottom: .5rem;
}
-
This reply was modified 6 years, 10 months ago by
pacosilva. Reason: car x auto