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

Dan Ridley
PLUS
Dan Ridley
Courses Plus Student 14,839 Points

Single Post Type be used to post to separate pages?

I am coding a Wordprees Theme for my wife's photography website. I am trying to figure out how I am going to code it so she can post her galleries from her photo sessions.

There are going to be 4 categories of galleries that my wife will post to the site. I want each category of galleries to have it's own page. I created separate pages for photos of Weddings, Portraits, Events, and Nature.

My question is Can I create just one Custom Post Type and is there a way to select what 1 of the 4 pages it will post to? or do I have to create 4 separate Custom post types and assign 1 to each of the 4 pages?

Any help is greatly appreciated.

Dan

Julian Price
Julian Price
11,760 Points

You could just publish menus for categories for the post type. If not visible check under menus > top area for your settings to make sure it's checked to be displayed

11 Answers

Julian Price
Julian Price
11,760 Points

Than just publish the menu item from category for post type. Try it first with regular post first to get an idea I what I talking about. Create several post for each of the above mentioned categories than go to menus and add the category to the menu

Julian Price
Julian Price
11,760 Points

You could just publish menus for categories for the post type. If not visible check under menus > top area for your settings to make sure it's checked to be displayed: https://www.evernote.com/shard/s174/sh/dbefae74-4490-4ce8-91f3-34524e9c1899/cd00aab130431d8869b3759e059d3924

https://www.evernote.com/shard/s174/sh/f62cf9e8-11ca-4fcf-85cd-03410713df3d/14741d2b1cbfb82f587756754ea07f93

Dan Ridley
PLUS
Dan Ridley
Courses Plus Student 14,839 Points

Hi Julian, Sorry if I am a little slow to understand with this. I am very new with Wordpress. If I create a Custom Post Type, will I be able to set a category for the gallery she posts and it will appear on its respective page?

Julian Price
Julian Price
11,760 Points

So I don't lead you down the wrong path. Tell me exactly where you are in the process. ie 1. working on live site if so (url) or local development site. 2. Are you creating your own theme or using one of available themes on Wordpress.org. 3. What other content you including besides the above mention for example is your wife going to use regular post for news/photographs tips or she is only interested in displaying her recent work. 4. What exactly else on each single photo page will you have ie obviously photos, description of shoot, you got the catgories names, fields.

Have you watched Zac Gordon http://teamtreehouse.com/library/how-to-build-a-wordpress-theme.

I ask because you may only need to use the regular post and media gallery could do the trick.

Dan Ridley
PLUS
Dan Ridley
Courses Plus Student 14,839 Points

Hello, 1 - I am working locally. 2 - I am creating my own theme using Zac's Classes on themes 3 - The blog section is for general things that she would like to blog about. 4 - What I want to do is have 4 different pages for the groups of photos. I want my wife to be able to post a group of photos she took from a specific photo session to one of these 4 different pages kinda like blog posts that link to the gallery when clicked. I hope that was clear enough.

This theme I am making sounds similar to what you are doing: http://www.dirtmiles.com/

Trips and Builds are two seperate post types, and two different php templates.

The front-page.php is the recent blog posts page ( the default post type. ).

Dan Ridley
PLUS
Dan Ridley
Courses Plus Student 14,839 Points

Hi Leonardo, It is possibly what I am trying to do. I am going to have 4 different pages that have posts, but I want to choose what page the post goes to. For example there is an events page, and I was wondering if there was a way that when my wife creates a post she can choose to send the post to the events page or if the post is for the weddings page, she can have it post on the weddings page. All the fields for the post are going to be the same no matter which one of the 4 pages it goes to. Note the blog is completely separate and already built.

Yeah, be efficient !

So create 4 post types, make one group of custom fields and four conditional logic options for the field group. These are under location tab in the Custom Fields plugin.

They look like this

Show this field group when " post type " is equal to 'events ' Show this field group when " post type " is equal to 'weddings ' Show this field group when " post type " is equal to ' birthdays '

Julian Price
Julian Price
11,760 Points

I was asking because you could create one post type like photography or galleries or collections, portfolios ... Etc you get the point and register a taxonomy for example portfolio_cats : than add a whateverposttype category: events, weddings,nature... If the archive page is going to be the same for them all. Let's say its a 3 or 4 entries across displaying 12 per page before pagination for each cat

Dan Ridley
PLUS
Dan Ridley
Courses Plus Student 14,839 Points

I definitely think I will do that Leonardo Hernandez and, Julian Price I am not sure I have learned what A Taxonomy is yet. I saw that as an option in the CPT UI Zac had us download in the class video. I have not play with that yet. Could you explain what it does?

Dan Ridley
PLUS
Dan Ridley
Courses Plus Student 14,839 Points

I was also wondering. Does Wordpress know automatically that the single-work template should used in relation to the work template because I keep getting the single template for the blog when I click the links.