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

WordPress

Custom Fields within a Page Template

Hi All,

I am creating a website with pages that use a 3 column layout. I could add the html markup for the 3 columns into the main content editor. However I'd prefer to add the separate WYSIWYG/Text area fields to the page editor to manage the three columns.

I'm wondering if anyone knows of a plugin that can handle this really well. I really like Custom Fields and Custom Post Type UI combination for doing the same thing with posts, so something similar would be good. Maybe this can be used but I'm not sure how.

I have been trying the Simple Fields plugin which does work, but the way the fields are added to the edit screen is a bit clumsy. The interface is also a bit tricky to manage.

Thanks :)

3 Answers

Zac Gordon
STAFF
Zac Gordon
Treehouse Guest Teacher

You can use the ACF plugin to create three text areas in the admin area and then in your template create the three columns and place the corresponding custom field into the correct column.

Thanks Zac. Can I apply this to pages as opposed to posts?

You're absolutely right - can't believe I didn't realise that before! Thanks!

Matt Campbell
Matt Campbell
9,767 Points

There's a plugin that adds columns but it does show the markup in the main text editor.

You can't use a plugin to divide your page up outside of the main text editor without a shed load of work which is pointless.

You'd be better off writing the actual HTML in a template file, give it a name of three column or something and then run a loop with a category search of three column, then posts you want in the three column page, add to the three column category. Or write a plugin that adds a checkbox for you to select which page template this post should use.

Thanks Matthew.

Yep, I'll be avoiding any plugins that try to create the columns for me.

I was hoping there might be a plugin that just adds fields to the page editor (col 1, 2, 3). I could then just draw out the content I needed in the template.

I'll investigate your suggestion using posts with a '3 column' category.