5

Let's say i need a page structured like the image below.

Structure There is a frontpage and from there i can choose one of the sites partners. Every partner gets a additional "partner page" which has to be editable from within the dashboard. Below the description of the partner would be a list of projects the partner has done. Every project is also fully editable.

Best case scenario would be a permalink structure like this:

  • Partner: www.example.org/partner1
  • Project: www.example.org/partner1/project-name

I dont know which approach is the best for this, should i build categories or taxonomies? This all seems tedious because there will be more than 100 partners and their projects.

I have build a lot of themes but never with a structure like this, so what is the best way to solve this ? (Categories, Taxonomy, CPT, some Plugin ...)

3
  • 1
    advancedcustomfields.com could help you relate other posts to your page. – jgraup Aug 27 '16 at 17:45
  • first some eclaircissements : a categorie is a special case of a taxonomy. page and post are special cases of CPT. and a plugin contain code that create new taxonomies and new CPT – mmm Aug 27 '16 at 18:33
  • Sorry but i don't understand your comment. – retober Aug 27 '16 at 18:46
2

I would not use WordPress pages nor articles for this. Simply, create a new custom post type called "Projects", with a plugin like Types, then create a new custom taxonomy "Partners" and associate it with that custom post type. Clean and easy structure.

3
  • I will have a look into "Types". Thank you. – retober Aug 29 '16 at 9:31
  • Having "partners" as a taxonomy is wrong since OP needs a single page for the partners. With a taxonomy, his "single" page would be the archive template and that's not right. See my answer for the right way to structure this. – somebodysomewhere Sep 1 '16 at 18:47
  • @Brian Partner 1 (term of taxonomy Partner), can have a description, so can Partner 2, 3... So unless he needs something more elaborate in the "Partner Page" than what he said (which is a "description"), this structure is perfectly fine. More details about what he needs, would be best, but given this info, my solution works fine. – The J Sep 1 '16 at 18:57
1

You can use page post type.

  • Simple to use.
  • Easy to edit with page-builder tools/plugins.
  • The permalink structure example.com/parent-page/child-1/child-1.1 is already available.

With "Categories", "Taxonomies" or "CPT", you have to register and rewrite permalink structures.

8
  • 1
    Unfortunately there are potential performance problems for large number of hierarchical post types in the backend, – birgire Aug 28 '16 at 7:45
  • yes it's a good idea to cache the menus. I think the performance problem of large page-parent dropdowns was reported 6+ years ago, so it's still possible to come up with new ideas there on how to solve it, if you are on the look for new challenges ;-) – birgire Aug 28 '16 at 8:16
  • You're always high as hell! Me 0, WordPress 1. KO. :-)) @birgire – wpclevel Aug 28 '16 at 8:23
  • 1
    hehe, I wonder if a page-parent-drilldown metabox, similar to how the customizer-drilldown works, would make any sense to solve the problem? But I'm still a customizer noob ;-) – birgire Aug 28 '16 at 8:31
  • @Dan9 There is no UX problem, the image i used is not the menu it is an illustration of the page structure. I will have a look in your answer, just using pages could be a viable solution. – retober Aug 29 '16 at 9:30
-1

Home - Create this as a page.

Partners - Create this is a custom post type since they need single pages (something like example.com/partner/partner1).

Projects - Create a taxonomy called "projects". The terms of that taxonomy will be your projects. Associate your taxonomy with the "partners" custom post type you created. This is the best way to share the same projects across partners.

Edit: If you want to create a permalink structure like example.com/{partner}/{project} then you can easily do that using custom rewrite rules.

add_rewrite_rule(
    'partner/([A-Za-z0-9\-\_]+)/?$',
    'index.php?pagename={your-template-slug}&project_slug=$matches[1]',
    'top'
);

Using WordPress query vars you can access the project_slug variable in your template and get the term object using get_term_by().

My proposed structure takes full advantage of how the WordPress core was designed. Doing it this way is also the most flexible way of structuring it, allowing you to easily add new templates in the future if your client requests them, whether it's an archive of all the projects, viewing projects associated to multiple specific partners, partner profiles without projects, etc.

The custom rewrite rules are completely optional, btw, but you'd need them if you want your custom permalink structure and want to use this data structure.

Edit: -1 points? Alright... this site has gotta be filled with amateurs.

6
  • How do you plan on adding the Project content to the term? since you dont have an editor, feat images or anything else besides a textarea? unless you use term meta, which is more complex than it needs to be. – The J Sep 1 '16 at 18:59
  • @TheJ The WordPress admin panel already has a title and description field for terms, but as someone else suggested in a reply to the original question, Advanced Custom Fields (even just the free version) can be used to easily add any field you like. – somebodysomewhere Sep 1 '16 at 19:19
  • Ok, let's go over this logically. It all depends on what he needs in Partners and Projects. - If he just needs simple text in Partners but something elaborate (eg. editor, img or meta) in Projects, then my solution works best. - If he needs something more elaborate in Partners, but just simple text in Projects, then your solution works best. - If he needs elaborate content on both, then he should consider a more complex solution. He said he needs a "description" in Partners, so I stand by my answer which I consider most logical to the OP problem. – The J Sep 1 '16 at 19:34
  • My solution caters to whether he needs elaborate content in both, a single one, or neither. The simple fact that you say that your solution is only good if he needs simple text in Partners should be reason enough to disregard your solution. He would be building a foundation with significant limitations. There is no "more complex" solution for more elaborate content. What I have proposed is the correct way to utilize the WP structure. ACF can take care of any "elaborate" content and this structure will allow you to query it any which way. – somebodysomewhere Sep 1 '16 at 22:29
  • My uninterest in arguing about this is as intense as your presumption. We both win! – The J Sep 1 '16 at 22:39

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.