Skip Navigation

[Resolved] replacing theme layout

This thread is resolved. Here is a description of the problem and solution.

Problem:
How to create different PHP template for different custom post type.

Solution:
To create different PHP template for your different custom post type you need to understand the template hierarchy of WordPress.

For example:

single-{custom-post-type-slug}.php

Where:
- Replace "{custom-post-type-slug}" with your original custom post type slug.

You can find proposed solution with the following reply:
https://toolset.com/forums/topic/replacing-theme-layout/#post-581369

Relevant Documentation:
https://developer.wordpress.org/themes/basics/template-hierarchy/#single-post

This support ticket is created 7 years, 1 month 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.

Our next available supporter will start replying to tickets in about 7.53 hours from now. Thank you for your understanding.

Sun Mon Tue Wed Thu Fri Sat
- 10:00 – 13:00 10:00 – 13:00 10:00 – 13:00 10:00 – 13:00 10: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: Asia/Kolkata (GMT+05:30)

This topic contains 2 replies, has 2 voices.

Last updated by marcelJ 7 years, 1 month ago.

Assisted by: Minesh.

Author
Posts
#581189

Hi,
My website is listing courses. I have created CPT's for 'courses' and 'organizers. Organizers is a parent of courses.
From the courses list view I'm linking to the organizer single post. All good.

I also created a template for 'organizers' and I can see that this template is being used on the organizer single post page.
However it looks like the organizer template is merely 'inserted' into the theme's 'single blog post' template.
Instead I would like to use only my newly created organizers template on this page.
It seems I need to 'force' the template to use a specific template for my CPT. How can I achieve this?

I had a look at these documents
https://toolset.com/documentation/user-guides/layouts-theme-integration/
https://toolset.com/documentation/getting-started-with-toolset/design-individual-posts-and-pages/

By the way I don't just want to edit the theme's 'single-post' template because I still use it for my blog.

hidden link

#581369

Minesh
Supporter

Languages: English (English )

Timezone: Asia/Kolkata (GMT+05:30)

Hello. Thank you for contacting the Toolset support.

Well - I would like to know you want to apply layout or content template to your single post?

If you have created layout - what if you create a PHP template file for only organizer post type.
For example:

single-organizer.php

More info:
=> https://developer.wordpress.org/themes/basics/template-hierarchy/#single-post

If above is not the solution you are looking for, I need exact information what you want to apply and where with problem URL and access details.

*** Please make a FULL BACKUP of your database and website.***
I would also eventually need to request temporary access (WP-Admin and FTP) to your site. Preferably to a test site where the problem has been replicated if possible in order to be of better help and check if some configurations might need to be changed.

I would additionally need your permission to de- and re-activate Plugins and the Theme, and to change configurations on the site. This is also a reason the backup is really important. If you agree to this, please use the form fields I have enabled below to provide temporary access details (wp-admin and FTP).

I have set the next reply to private which means only you and I have access to it.

#581635

Hi Minesh,
Thanks for the link. That is some interesting reading I should have done much earlier.
So, I made a single-organizer.php like you suggested and copied and renamed the php files that are subsequently pointed to.
This works fine so the issue is resolved.

Thanks!
Marcel