Skip Navigation

[Resolved] Custom post type setup

This support ticket is created 2 years, 9 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
9:00 – 13:00 9:00 – 13:00 9:00 – 13:00 9:00 – 13:00 - - 9:00 – 13:00
14:00 – 18:00 14:00 – 18:00 14:00 – 18:00 14:00 – 18:00 - - 14:00 – 18:00

Supporter timezone: Africa/Casablanca (GMT+00:00)

This topic contains 5 replies, has 3 voices.

Last updated by Jamal 2 years, 9 months ago.

Assisted by: Jamal.

Author
Posts
#2098337

Hello 🙂

Tell us what you are trying to do?
I want to set up a custom post type for activities. This Custom Post Type should contain different subcategories to which the individual posts are then assigned.

The URL should look like the following:
domain.com/customposttype/category/title-of-post

The Archive Page of the custom post type should look like this:
Ideally, I would like to create this directly with Divi Builder and then just redirect to the subcategories from there and read out the individual posts.

How do I get this implemented?
I have created the CPT. But the categories and the Divi page as archives I do not get integrated.

Is there a similar example that we can see?
hidden link

You need to look for this article (it's the only one which is assigned to the custom post type until now)
hidden link

How do I need to set this up with Toolset?

Thanks in advance.

#2098911

Nigel
Supporter

Languages: English (English ) Spanish (Español )

Timezone: Europe/London (GMT+01:00)

I'm not sure I really understand your question.

You have a custom post type. When you say it should "contain different sub-categories" do you mean that the post type should have a taxonomy (such as categories) assigned to it?

So your custom post type could be "flowers" and you have categories "red", "purple", "yellow" etc.

Or do you mean something different when you say the post type should contain different sub-categories?

The typical URL structure for CPT posts is site.com/cpt-slug/post-name/.

You would like a different structure, site.com/cpt-slug/category/post-name/

If you edit the CPT at Toolset > Custom Post Types, the Options allow for setting custom rewrite rules, but that doesn't accept placeholders in the same way that the Settings > Permalinks page does.

To create such a permalink structure for your CPT you would need to either write custom rewrite rules in PHP, or use a plugin which provides a simpler way of creating custom rewrite rules that are more flexible than those offered by WordPress itself.

The structure you are proposing does seem inherently problematic, though, if your posts can have more than one category assigned (as only one category can appear in the URL).

Lastly, there is the question of using Divi or Toolset to design these pages. You talk about them as archives, but these are not archives, these are single posts we are describing, if I have understood you correctly.

In any case, you can choose to design templates for single posts with either Toolset or Divi, and likewise you can design custom archives with either Toolset or Divi. I can't really help with designing them with Divi, but if you need help designing them with Toolset we can help with that.

#2099051

Hello Nigel,

thank you very much for your feedback.
Yes you have understood that correctly. I am primarily concerned with having the page structure (and thus the structure of the URL) as you mentioned. This has SEO background in particular.

Let's start from a concrete example. The URL should look like this

hidden link

hidden link
Is an overview page. Doesn't matter to me if this is an archive or a page. However, I would like to design this with Divi and the Theme Builder. From here, the last posts of each category should be displayed separately and there should be a link to the respective category.

hidden link
"Watersport-Action" is one of the categories I want to create. Here all posts should be listed, which are assigned to this category.

hidden link
Is a single post. This post already exists and can be found at: hidden link. This one does not need to be changed. Only the breadcrump navigation above the title should show the correct path.

Can you help me how to do this exactly?
I've tried around so much that I'm now quite confused as to what is the right way to achieve the structure I want.

Thanks already 🙂

#2099323

Jamal
Supporter

Languages: English (English ) French (Français )

Timezone: Africa/Casablanca (GMT+00:00)

Hello there! I hope you wouldn't mind that I continue with you on this thread.

Regarding the URL structure, as Nigel explained, you will need custom code that defines rewrite URLs, or you may use a 3rd party plugin that will ensure that. Check this online thread and the WordPress documentation for examples:
- https://wordpress.stackexchange.com/questions/21022/mixing-custom-post-type-and-taxonomy-rewrite-structures
- https://developer.wordpress.org/reference/functions/add_rewrite_rule/

Or you may use a 3rd party plugin, such as:
- https://wordpress.org/plugins/custom-post-type-permalinks/
- hidden link
Note that you will be using them at your own risk, we do not endorse any of them.

Regarding the use of Divi, please note that we recommend not mixing Toolset and Divi on the same page. Check this article https://toolset.com/2020/01/how-to-build-advanced-sites-with-toolset-and-divi/

However, we provide a partial integration, by offering a Divi module to display a Toolset view. Read more about it here https://toolset.com/course-lesson/using-toolset-with-divi/

I hope this helps. Let me know if you have any questions.

#2099343

If I understand you correctly, all I have to do is the following:

1. create a CPT. This can be found under
sansibar-urlaub.de/sehenswuerdigkeiten-ausfluege-aktivitaeten-sansibar/

2. create a Custom Taxonomy with subcategory. This can be found at
sansibar-urlaub.de/aktivitaeten/unterkategorie/

And the jump from
sansibar-urlaub.de/aktivitaeten/unterkategorie/
to
sansibar-urlaub.de/sehenswuerdigkeiten-ausfluege-aktivitaeten-sansibar/unterkategorie/
do I then purely with the code or module for the Custom Rewrite URL?

Sorry to have to ask again.

#2099377

Jamal
Supporter

Languages: English (English ) French (Français )

Timezone: Africa/Casablanca (GMT+00:00)

Well, regarding (1) yes, regarding (2) yes. Then the jump from sansibar-urlaub.de/aktivitaeten/unterkategorie/
to
sansibar-urlaub.de/sehenswuerdigkeiten-ausfluege-aktivitaeten-sansibar/unterkategorie/
will need one of the solutions, you decide:
- Either, a custom code solution, using the add_rewrite_rule
- Or, using a 3rd party plugin.

I can't really tell you what solution of both you need to do, because both solutions are out of the scope of Toolset support. You will have to decide this on your own. Please, do not understand this as escaping responsibility, it is just out of the scope of Toolset support.

Honestly, If you are not comfortable with programming or you don't want to hire a developer, I would suggest using a plugin for that.

This ticket is now closed. If you're a WPML client and need related help, please open a new support ticket.