Welcome to the Treehouse Community
Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community!
Looking to learn something new?
Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.
Start your free trial
Gabriel Ward
20,222 PointsSelecting half the content of a post.
I want to display the content of my posts in over two columns. Does anyone know how I might do this? I was thinking using multiple loops, with each column having its own div, and within each div there is a loop. I'm not sure how to call the first half the post in the first column and the second half the post in the second though. Thanks for any help!
1 Answer

Rich Bagley
25,868 PointsHi Gabriel,
Not sure if this is the type of thing that you were thinking but it could be possible using CSS (specifically CSS3).
The Multi-Column layout page on w3schools will go over the basics but CSS Tricks also has an article on making sure this is responsive.
You wouldn't need to use multiple loops this way.
-Rich
Gabriel Ward
20,222 PointsGabriel Ward
20,222 PointsHi Rich,
Thank you for your suggestion. I have't tried it yet but it looks like it'd work. So I'll give it a go. Just for interest sake though, is it possible to do what I was at first thinking, in terms of selecting half of the content of a post.
Just because at the moment I'm using Guil Hernandez's grid system that he teaches in his CSS course here on Treehouse, as my static template that I'm trying to convert into a Wordpress theme. And within that frame work I'm thinking that selecting certain parts of content in each column would be the first option to try. His grid system doesn't use the multi-column syntax as mentioned in your two links above. I am going to have a go at making that work though.
Cheers for your help
Gabe
Rich Bagley
25,868 PointsRich Bagley
25,868 PointsHi Gabe,
Honestly, I haven't tried it to be 100% sure. One way that could work would be to use the Advanced Custom Fields plugin. You'd then create the fields you wanted and put the different sections of text within separate fields so you could position them exactly where you need on the page.
-Rich
Gabriel Ward
20,222 PointsGabriel Ward
20,222 PointsHi Rich,
THanks for your recommendation regarding multi-columns. It worked no problem so I now have a solution.
I do have another thing I'm having problems with. The featured images of posts are not displaying correctly. Instead of cropping and remaining in proportion, they are stretching. Do you have any suggestion on what the problem might be? I'm trying to play around with the set_thumbnail_size in functions.php. So far no luck.
Really appreciate all your help.
Rich Bagley
25,868 PointsRich Bagley
25,868 PointsHi Gabe,
No problem, It's a little bit of a guess but it sounds as though it's CSS related. One way to check would be to use the browser developer tools (usually F12 when in the browser or right click on the image and select 'Inspect Element').
You'll then be able to see if the width and height is restricted in the style sheet.
Hope that helps :)
-Rich
Gabriel Ward
20,222 PointsGabriel Ward
20,222 PointsHi Rich,
I just posted the following question in the forum
I want to have my thumbnails be responsive in size and also remain in proportion. However the images don't keep their proportion when the browser is changed in size.
Here's my relevant code, in particular the feat-img div.
home.php
style.css
I've been playing around with this for a while and not had any luck. I'm not sure if the feat-img CSS needs to be changed or whether something needs to be changed in home.php