Community Forums › Forums › StudioPress Themes › Monochrome Pro › Apply Monochrome single.php to singular.php – all post types
Tagged: featured image, page.php, single.php, singular.php
- This topic has 3 replies, 2 voices, and was last updated 1 year, 1 month ago by
joycegrace.
-
AuthorPosts
-
April 22, 2022 at 9:51 pm #505081
joycegrace
ParticipantHello 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?
Thank you
Find me at Joyce Grace (http://www.joycegrace.ca)
April 23, 2022 at 5:49 am #505087Victor Font
ModeratorFor 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/
Regards,
Victor
https://victorfont.com/
Call us toll free: 844-VIC-FONT (842-3668)
Have you requested your free website audit yet?April 23, 2022 at 3:39 pm #505090joycegrace
ParticipantThan 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...
Find me at Joyce Grace (http://www.joycegrace.ca)
April 23, 2022 at 5:16 pm #505091joycegrace
ParticipantI had a bit of a revelation that the single.php code applies to full-width templates and that's why it wasn't working on the content-sidebar page that I was testing it on... having one of those moments...
Find me at Joyce Grace (http://www.joycegrace.ca)
-
AuthorPosts
- You must be logged in to reply to this topic.