Skip Navigation

[Resolved] Initial Post Type Setup & CRED Form Options

This support ticket is created 6 years, 8 months ago. There's a good chance that you are reading advice that it now obsolete.

This is the technical support forum for Toolset - a suite of plugins for developing WordPress sites without writing PHP.

Everyone can read this forum, but only Toolset clients can post in it. Toolset support works 6 days per week, 19 hours per day.

Sun Mon Tue Wed Thu Fri Sat
8:00 – 12:00 8:00 – 12:00 8:00 – 12:00 8:00 – 12:00 8:00 – 12:00 - -
13:00 – 17:00 13:00 – 17:00 13:00 – 17:00 13:00 – 17:00 13:00 – 17:00 - -

Supporter timezone: America/New_York (GMT-04:00)

Author
Posts
#625362

J S

Tell us what you are trying to do?

I'm setting up a site that allows educators to submit a variety of content related to the integration of Liberal Arts into Engineering and Technology curriculum. The content being submited will consist of Articles (links, text, files), Lesson Plans (text & files), Complete Courses (text & files), Presentations (text & files), Videos (text & links to YouTube or Vimeo), Other (text & files). Each type of content will have basic fields like title, description, date submitted, source, contributor name etc.

Originally I was thinking of setting up a seperate CPT for each type of content, but then there would have to be seperate forms for each type of content as well. Given that most of the content will have similar, if not identical fields, I'm now thinking it makes more sense to set up one CPT called "Content Submissions" and then merely have several taxonomies associated with the CPT to help organize the submitted content on the site. This approach will simplify admin as there will only be one CRED form to manage, etc. The Custom Taxonomies would be 1.) the type of submission - article, lesson Plan, course, presentation etc., AND 2.) the category - Science, Technology, Engineering, Mathematics etc.

Depending on the type of submission selected for Taxonomy 1, the content could then be organized into a view/layout/page that only displays Articles, then another for Lesson Plans etc.

Does the above approach make sense? Please indicate why or why not.

I can think of one potential issue with the above approach when it comes to content submissions, that can probably be handled by CRED but need some advice to be sure before proceeding.

Let's say I create a form for the above, is it possible for the required fields in the form to change, based on a user's selection of a Custom Taxonomy from a drop down?

In other words, if a user selects Article or Presentation as the type of material being submitted, the remainder of the form will change to fields needed specifically for articles, whereas if they selected Video as the type of material being submitted, the form would not have an option for uploading files, but rather change to show a field where a YouTube or Viemo link can be entered.

I guess the question here is would you reccomend setting this up as a single custom post type using custom taxonomies for differentiation and accepting submissions using a conditional CRED form --- OR --- setting this up with multiple custom post types and multiple forms.

From a useability point of view, I think my client will prefer a single form and I believe a single post type will be a little easier to administer.

I greatly appreciate any advice in setting this up!

What is the link to your site? In development here: hidden link

#625430

Does the above approach make sense? Please indicate why or why not.
Sure, it makes sense. Determining whether or not it is the best approach is the challenge. First, I recommend reading up on WordPress to understand the differences between custom post types and taxonomies, and how each is used differently by WordPress:
http://www.wpbeginner.com/beginners-guide/when-do-you-need-a-custom-post-type-or-taxonomy-in-wordpress/

I think the answer here really depends a lot on the requirements of your site. Post types and taxonomies have different uses and different feature sets in WordPress. For example, posts get their own unique single post URL and automatically generated archives. Terms can be applied across multiple post types to relate posts, and can also be used as View filters. It is not currently possible to create a custom search form that allows Users to filter by post type. It is not currently possible to filter a term archive by terms in that same taxonomy. There are so many differences and little nuances that it's difficult to know exactly which is right based on a short description of the site, and sometimes it makes the most sense to start building out a site with just a few of each element to see how things fit together and what's possible.

Let's say I create a form for the above, is it possible for the required fields in the form to change, based on a user's selection of a Custom Taxonomy from a drop down?
To some degree, it is possible to show and hide fields in a CRED form based on other field selections. It is not exactly possible to toggle the "required" status of a single field with a conditional, but with some custom code you could enforce your own custom validation in PHP. More information about the CRED conditional engine here:
https://toolset.com/documentation/user-guides/conditional-display-for-form-inputs/
https://toolset.com/documentation/user-guides/cred-conditional-display-engine/
Advanced users can read about the validation API here:
https://toolset.com/documentation/programmer-reference/cred-api/#cred_form_validate

From a useability point of view, I think my client will prefer a single form and I believe a single post type will be a little easier to administer.
If you decide to use separate post types, then a single form is not possible. Each CRED form can only create posts of a single post type, so you would be required to create separate forms for each CPT.

Let me know your thoughts and we can continue discussion.

#626688

J S

I am aware of the dfferences in WordPress but was not sure how Types would play into this scenario. I decided that a single form was important and went with the single CPT approach.

I do need to figure out how I can change permalinks and urls to follow this approach so that the urls reflect the taxonomy for each post.

So following above approach, I created a CPT called "Submissions" (slug: submissions) and a Custom Taxonomy called "Submission Type" (slug: submission-type). I've formatted the archives page for submissions and have that working nicely, but I can't figure out how to get the submission type to show up in the url for each post. Instead of the posts showing up under the custom taxonomy, they show up under the CPT type.

In other words, I see the url as .../submissions/post_name instead of .../submissions/custom-taxonomy-name/post_name

The reason for needing this is consistency, as when the taxnomoy is displayed on the archive page, the taxnomy is named, for example, there is an archive page called /submissions/ and an archive page called /submissions/articles , /submissions/videos/ , /submissions/presentations etc. but when you click the posts within any of these taxonomy categories, the url strips the category and instead just uses /submissions/post-name/ This will be confusing for users. So instead we want the custom taxonomy category name to show up like this /submissions/articles/post-name/

I've tried to overide this by using the rewrite option in wp-admin/Toolset/Edit Taxonomy/Options and enterin the word submissions to override submission-type, but it breaks the link to the individual posts and a warning shows up in the Types admin saying that is not recommended. I've also tried to change the permalink settings in wp-admin to "Custom Structure" /%category%/%postname%/ but it didn't seem to work either.

Is there a clean way to accomplish this?

#626695

As the warning says, this type of URL structure is not recommended. Toolset is designed to work within the standard WordPress permalink structures, which do not mix post type and taxonomy term slugs like this. You can try a 3rd-party plugin like Custom Post Type Permalinks, or you can try custom code that implements the WordPress API and rewrite rules, but we do not offer this kind of permalink structure modification support here in the forums.

#626707

J S

Ok, I understand. Tell me this, would you recommend using the built-in archives pages to display my CPTs and Custom Taxonomies, or disabling the archives for this CPT and building a page to display the CPT? I can't think of a reason not to use the archives but maybe I'm missing something....?

#626735

You would use a page with a View instead of the standard WordPress Archive if you want the "archive" to appear at a non-standard archive URL. For example if your post type slug is "animal" and you want to show an archive at "my-animals", then that's a non-standard URL structure. That would require a View and a custom Page. Some custom search filters are not implemented in archives, like the distance filter. It's also not possible to allow Users to filter a taxonomy term archive by the same taxonomy. These are the 3 technical reasons that come to mind, where you would need to use a custom page and View instead of a WordPress Archive. Most of the time the WordPress Archive approach is fine, though.

#627737

J S

Went with single CPT and custom taxonomy and seems to be working for our needs... thanks