April 22, 2022 at 9:51 pm #505081
Hello I'm wondering if someone can tell me how to get this design: https://demo.studiopress.com/monochrome/minimal-design/ (Monochrome single.php) to apply to pages and custom post types?
I have the custom post types set up to follow the single.php, so that's fine.
Pages still won't show featured the 'big' featured image like on the posts.
When I read WordPress docs here: https://developer.wordpress.org/themes/template-files-section/post-template-files/#singular-php it seems like singular.php is the way to go to get all post types, including page.php to use one template.
I tried changing the name of single.php to singular.php hoping that would work but it didn't. It took away the featured image.
Does anyone know the answer to this?
April 23, 2022 at 5:49 am #505087Victor FontModerator
For CPTs, WordPress requires the template to include the CPT's slug in its name. See this: https://developer.wordpress.org/themes/template-files-section/custom-post-type-template-files/
April 23, 2022 at 3:39 pm #505090
Than you Victor, but this is not for custom post types. This is for the native Pages in WordPress. I'm trying to get the native Pages to use the same layout as the native Posts, based on the single.php file in Monochrome Pro. It is not doing that, even if I copy the code from single.php into page.php.
Also not sure if you had a look at the link I provided, but my understanding of what it says it that any post type can use singular.php:
"WordPress Version 4.3 added singular.php that comes in the hierarchy after single.php for posts, page.php for pages, and the variations of each. This template follows the rules of is_singular() and is used for a single post, regardless of post type. Themes that used the same code for both of those files (or included one in the other) can now simplify down to the one template."
So I'm hoping I can just use one file, as it says above, instead of creating custom post type templates, single.php templates, page.php templates and so on.
Let me know if I read that wrong...
April 23, 2022 at 5:16 pm #505091
- You must be logged in to reply to this topic.