Problem:
I've modified my theme files to integrate "layouts": everything works, but now when I load a standard article (WP Posts) I just see the title. Is it possible that "standard" posts remain with the original layout of the theme and Custom Post Types use the Layouts created with layouts plugin?
Solution:
Yes it's possible, you need to have 2 things in your theme, two separate template files for each post type. For example if you have custom post type called “Portfolio” and a normal WP post type “Posts”.
- Posts is loading template file = single.php
- Portfolio is loading template file = single.php (yes same, as theme does not have its own template file).
So what we need to tell “Portfolio” post type, is to load its own template file (single-portfolio.php) and normal blog posts should keep loading the original (single.php) template file. To do this:
- Make a copy and rename single.php >> as single-portfolio.php template file in your theme. This should have the layouts integration the_ddlayout();
- Resave the permalinks in WP Dashboard >> Settings >> Permalinks.
- Whereas your original single.php should not have layouts integration, because now it will only be used for the blog Posts.
Relevant Documentation:
You can read more about WordPress Template Hierarchy here (Single Post): https://developer.wordpress.org/themes/basics/template-hierarchy/#single-post
Everyone can read this forum, but only Toolset clients and people who registered for Types community support can post in it.
Sun | Mon | Tue | Wed | Thu | Fri | Sat |
---|---|---|---|---|---|---|
- | 12:00 – 17:00 | 12:00 – 17:00 | 12:00 – 17:00 | 12:00 – 17:00 | 12:00 – 17:00 | - |
- | 18:00 – 21:00 | 18:00 – 21:00 | 18:00 – 21:00 | 18:00 – 21:00 | 18:00 – 21:00 | - |
Supporter timezone: Asia/Karachi (GMT+05:00)
This topic contains 6 replies, has 2 voices.
Last updated by 7 years, 5 months ago.
Assisted by: Noman.
The forum ‘Types Community Support’ is closed to new topics and replies.