Skip Navigation

[Resolved] How to handle custom url structure with custom post type

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 – 12:00 9:00 – 12:00 9:00 – 12:00 9:00 – 12:00 9:00 – 12:00 -
- 13:00 – 18:00 13:00 – 18:00 13:00 – 18:00 14:00 – 18:00 13:00 – 18:00 -

Supporter timezone: America/Jamaica (GMT-05:00)

This topic contains 3 replies, has 2 voices.

Last updated by Shane 2 years, 9 months ago.

Assisted by: Shane.

Author
Posts
#2270721

Let's say I have a post type "Course" and I have a url structure for them like:
/course/course01
/course/course02
, etc.

I want to add some functionality like course booking but due to SEO/cache and other reason I don't what to use URL params like ?action=book but use URL structure like:

/coursebook/course01
/coursebook/course02

or

/course/course01/book
/course/course02/book

On these pages I want to handle booking process depend on chosen course but also change some page content like title based on the chosen course and it's details.

Is there any way to do it?

#2270761

Shane
Supporter

Languages: English (English )

Timezone: America/Jamaica (GMT-05:00)

Hi Kirill,

Thank you for getting in touch. When handling custom URL structures this usually involves some amount of custom code. However looking at the structure below it would appear that /coursebook / would be the slug of the custom post type is that correct?

/coursebook/course01
/coursebook/course02

Then course01 would be the name/title of the actual course correct?

Please let me know.

Thanks,
Shane

#2270799

Hi Shane, thanks for the reply.

Not exactly, /coursebook/ is the page there I want to handle booking process for chosen course by second part of url such as /course01/ or /course02/

I understand that it should be some custom code. The question is mainly about how to handle part of url as param for page or custom post template to define action or custom post for action.

#2271339

Shane
Supporter

Languages: English (English )

Timezone: America/Jamaica (GMT-05:00)

Hi Kirill,

Thank you for the clarity.

I understand what you mean now, it would essentially be a Parent/Child breadcrumb in the URL.

Unfortunately given such the case it would require custom coding to rewrite the URL in such a fashion. The custom code required to achieve this is out of the scope of our support forum and as such I would recommend getting a contractor to craft a solution for you.

You can get in touch with any of the contractors that are registered to our site at the link below.
https://toolset.com/contractors/

Please let me know if this helps.
Thanks,
Shane