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! While you're at it, check out some resources Treehouse students have shared here.

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

Rebecca Jensen
Rebecca Jensen
11,580 Points

Events (like, real-life events): best published as a page or post?

I'm building a Wordpress site that deals with events. The event 'pages' themselves require custom fields, then the 'page' itself must expire and go into an archive/results list once the date has passed. AND, basic information about the event must populate itself elsewhere on the site (such as in the Upcoming Events calendar).

Should I build my event 'pages' as true "pages" or as "posts"?

Hi Rebecca,

Just out of curiosity, would you consider using a plugin or are you trying to build from scratch?

-Rich

Rebecca Jensen
Rebecca Jensen
11,580 Points

Hi Rich,

I would consider a plugin, though I like to learn how to build things from scratch. Though I don't know if this requires a bit of light PHP or in-depth knowledge.

Thanks!

-Rebecca

2 Answers

Hi Rebecca,

If you're happy with using plugins then Events Manager might be a good one to take a look at. Obviously check it out before committing to it but you're basically able to use it as both a way to display events and also take paid bookings if upgraded to Pro (please note the Pro part isn't free - although you may not require it anyway).

If you'd prefer to create a custom page instead of use the above you may also want to take a look at the Custom Post Type UI plugin. This works great with the Advanced Custom Fields plugin.

Hope they help in some way :)

-Rich

Rebecca Jensen
Rebecca Jensen
11,580 Points

Hi Rich,

Yeah, I took a look at Advanced Custom Fields and their Flexible Content fields look like they would be excellent for my needs. I am not quite clear on whether I can use ACF for posts, pages, or both. And, I'm wondering whether posts or pages would be best for publishing events. Since the events are time-sensitive (post?) but also need to do more complicated things like expire and display under results once the date has passed (...page?), and also populate their content in other areas (calendar of upcoming events, results).

What's your feeling about post vs. page? My guess is page, but that's just a guess.

Sue Dough
Sue Dough
35,800 Points

It sounds like you should use neither. It would be better to keep your pages, post and events separated. You could easily make a custom post type. I recommend doing it without any plugins since it it only takes a moment to do and your site will be faster without a plugin. Check out (https://codex.wordpress.org/Post_Types) to see how to create a custom post type called events. Then you could either code your own fields or use advanced custom fields plugin.

Rebecca Jensen
Rebecca Jensen
11,580 Points

Hi Ghost,

Thank you for your input. Yes, I think creating a custom post type and using advanced custom fields seem to be the best way to build it.

My resulting question is: are custom post types posts, pages, or neither? (Ok, I realize that "post" is in the name of the function, but still...).

The site will also have a news blog, so if the events are posts, then I will have to figure out how to have the two blogs not conflict with each other (can I have a home-news.php and home-events.php?). Also, I need to check that the posts can be listed by the date they're happening, not just the date they're published, which is the default for posts.

It seems that making pages for events would dodge some of these complications, but I don't know if it's better practice to use posts for some reasons I'm missing. What are your thoughts?

Thanks again,

Rebecca