1

The Problem : I need to make a website of my Portfolio using Advanced Custom Fields and Custom Post Types UI plugins.

Approach 1: Make a seperate post type for each Portfolio type (photgraphy projects, website development projects, videography projects)

Approach 2: Make only one post type of (portfolio) , and then add custom fields with all the required values for all project typed, and use PHP conditional statements on the back end to select the relevant fields only and show them according to the portfolio type (a custom field of its own)

Which is better ?

It seems to me that the first approach is simple and more straight forward, but I'm thinking what If I would like to show all my projects on a simple page, how would I be able to show several post types together ...

Thanks for helping me out

1
  • Approach 2. One post_type e.g. portfolio. Use meta data to define attributes according to your speicfications and taxonomies to help you categories your types.
    – Adam
    Feb 19, 2016 at 12:29

3 Answers 3

1

Coincident that you both have 1 in rep? ;)

You want to go to Approach 2 for sure. It's very simple to query posts by post type and custom data field. In addition you can use different categories.

Creating 3 different post types will create a lot of redundancy since your posts will basically have the same content.

I feel that this isn't a WordPress question per se, so this question might be considered off topic.

0

Choosing between different custom post types and one custom post types with different custom attributes is completely depends on requirement.

For your requirement, I think separate custom post types is decent way. Because it will make managing this more simpler and in future you may add other post types that makes this approach scalable.

Second point is, the three custom post types that you suggested is completely independent on each other. So better choice is to make separate custom post types.

Make separate data base tables and separate templates(view) for each post types.

Hope this helps.

0
0

This will ultimately depend on how closely related the 3 portfolio types are and how big of a development process this is.

If the 3 types are going to share lots of the same fields, (e.g. Date, Description, Type, etc), then it makes sense to take Approach 2 and handle each Type differently when necessary. If the portfolio types are relatively similar, Approach 2 will save a lot of duplicate code. Less markup, but less flexibility and room for growth.

Conversely, if the portfolio types will have very different data and will be handled in very different ways on the frontend, then maybe Approach 1 is the way to go - duplicating some of that code for easier expansion later might be worth it. More markup, but more flexibility and room for growth.

If this were my project, I would begin with Approach 2 for simplicity, and then if I found myself writing a lot of switch(type)... code, consider a switch to Approach 1.

EDIT: Approach 1 will require a more custom implementation of an "All Projects" page - likely 3 separate queries for each post type.

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

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