Skip Navigation

[Resolved] How to create custom Post PHP templates

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

Problem

How can I create custom PHP templates to address my custom posts?

Solution

If you need to create Custom PHP templates for Custom Post Types in WordPress you can follow and refer to the WordPress Codex for it.

To create such a file, you need to name it "single-post_type_slug.php" (replace "post_type_slug" with the slug of your post type).
Then, this file will be used instead of the single.php file.

We also have documentation for the Toolset related part of this, which is to display Types Fields for example, with PHP, or how to fully customize Archives and other templates using PHP.
However, it's easier to use Toolset Views to display the data.

Usually, Toolset allows you to customize the entire website without the use of PHP - only if you use just Types, then the usageo of custom code is not avoidable.

This support ticket is created 6 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
- - 14:00 – 20:00 14:00 – 20:00 14:00 – 20:00 14:00 – 20:00 14:00 – 20:00
- - - - - - -

Supporter timezone: Asia/Ho_Chi_Minh (GMT+07:00)

This topic contains 2 replies, has 3 voices.

Last updated by xiaolinW 6 years, 9 months ago.

Assisted by: Beda.

Author
Posts
#625825

Tell us what you are trying to do? We created some custom post types and we need to apply a custom template instead single.php file (what we need to achieve is to create a clone of the single.php file without header and footer and apply it to the custom post types).
How can we achieve this?

We already created something like that for a page template, but we don't know how to achieve the same to a custom post type.

Thanks for any info about that.

Franco

#625857

If you need to create Custom PHP templates for Custom Post Types in WordPress you can follow and refer to the WordPress Codex for it:
https://developer.wordpress.org/themes/basics/template-hierarchy/

To create such a file, you need to name it "single-post_type_slug.php" (replace "post_type_slug" with the slug of your post type).
Then, this file will be used instead of the single.php file.

We also have documentation for the Toolset related part of this, which is to display Types Fields for example, with PHP:
https://toolset.com/documentation/customizing-sites-using-php/

#2048513

How can I create the template in php and make it appear in the toolset section as a template choice (add post editor page)