0

Okay I'm a designer who is new to Wordpress but I'm having some trouble wrapping my head around how to properly use post types.

I'm rebuilding my portfolio in a CMS. I get how to make pages easily.

  1. I create a PHP file.
  2. I assign it a template name up at the top in comments. (for instance "template: homepage"
  3. I then go to wp-admin and create a new page, and assign it the template.
  4. I then can add custom fields etc to that page using the Custom Fields plugin, and associating it with that page
  5. I can then pull in those fields using php inside the php file. (get_field etc). Result: When I go to that page (which I can see as a permalink in the wp-admin edit page section) I then see all the field data output that I asked for in PHP etc into HTML.

Now I'm having problems getting all the way here with Post types. I am going to have a blog on my website. But I'm also going to have portfolio case studies in my portfolio section. I was going to try and make my own custom post type for case study using Custom Post Types UI but I wasn't sure how to do it, and people online told me to just use Jetpack plugin.

So here's what I've done so far.

  1. Create new Portfolio Post type using the Jetpack portfolio custom post type.
  2. Give the Portfolio Post a name, and featured image.
  3. Create a bunch of custom fields for it in Advanced Custom Fields and associate it with that the Portfolio Post Type
  4. Fill out those custom fields
  5. Repeat this 5 times for different portfolio case study pieces.

....... and now... what?

Everything I look up relates to blog posts. I can find some things that refer to the Jetpack portfolio post type shortcode, but I don't want that. Do I need to create a page for each page and then have it call the contents of the post... like selecting it by ID or something like that? I see how to query for a bunch of posts on a single page by querying for it (but I don't entirely understand how to do that for portfolio posts instead of blog posts) and I also don't understand how to call the content of just a single post onto a page, either as a page dedicated to that post, or just pulling in selectively information from that portfolio post's field data onto an unrelated page (like if I wanted to place a little box on my front page that would pull the title and featured image from a post and that's it)

Anybody able to point me in the right direction? I'm doing extensive searching and reading for the last couple of hours but I'm not getting anywhere fast.

0

Custom post types don't need a template created for them. They will automatically use the archive.php and single.php of your theme. If you want to customize a page so that your portfolio and your regular blogs are different then you need to create 2 files.

archive-postname.php (in this case it's whatever you named your post type ie "portfolios") This loads the archive page of your cpts or the roll, basically the list of all your posts on one page. You would get to it by going to www.example.com/portfolios/ (or whatever you've set your posttype to be)

then you have your single-postname.php

this loads the post detail or single view. this is what someone would see if they went to www.example.com/portfolios/cool-project-1

This is based on a few things. I'm assuming your post type is exactly portfolios, and that you don't have an slug redirects etc. It's also assuming that in settings/permalinks you have set to %postname%.

  • Excellent thank you! This helped clarify things for me a lot! – David A. French Apr 15 '17 at 3:57

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.