- This topic has 7 replies, 3 voices, and was last updated 9 years, 2 months ago by
Tom.
-
AuthorPosts
-
January 13, 2016 at 12:22 pm #165629
Alessio Angeloro
Hi Tom,
i have created a template child with some customization, now i would to create a different post layout for some post, i’have tried with “content-single-%mypostid%.php” but not working; also is it possibile to make this change for the page layout ?
Thansk so much
RegardsJanuary 13, 2016 at 11:46 pm #165708Tom
Lead DeveloperLead DeveloperHi there,
Hmm, did you find somewhere that told you to use this kind of file name?:
content-single-%mypostid%.phpI can’t find any information on using custom page templates for posts.
What do you mean by making the change for the page layout?
Let me know 🙂
January 14, 2016 at 1:01 am #165715Alessio Angeloro
Hi Tom,
yes but not with GP, let’s hope the logic it’s the same.
See this documents https://developer.wordpress.org/themes/template-files-section/page-template-files/page-templates/
I need to load some script / php code only in some post or pages.
Please let me know.
January 14, 2016 at 10:24 am #165795Tom
Lead DeveloperLead DeveloperThe first point on that page says this:
Page templates only apply to pages, not to any other content type (like posts and custom post types).
You can load scripts/PHP code on some posts or pages by using if conditionals: https://codex.wordpress.org/Conditional_Tags
Specific pages: https://codex.wordpress.org/Conditional_Tags#A_PAGE_Page
Specific posts: https://codex.wordpress.org/Conditional_Tags#A_Single_Post_PageJanuary 15, 2017 at 2:09 pm #264384Jessica
I too would love to create different custom layouts for the different blog post formats. I’ve seen it before on other people’s site’s so I’m assuming there’s a way to do it.
Would I create a custom page called
– content-single-aside.php
– content-single-quote.php
etc.?I want to be able to have custom layouts for each of these format types.
January 15, 2017 at 9:32 pm #264438Tom
Lead DeveloperLead DeveloperI believe it should just be:
content-aside.php
content-quote.phpetc..
January 16, 2017 at 3:56 pm #264751Jessica
Thanks. Worked with a colleague and got it worked out.
Howevever, these are the only formats I see to choose from:
standard
aside
image
video
quote
link
statusYour example (I found in another post) referenced additional types:
gallery
audio
chatIs there a way to enable the last 3?
I’ve since created a custom workaround to have (essentially) custom post types for the blog posts and created custom page templates but wondered but those last 3 weren’t showing up in the format options.
Thanks!
January 16, 2017 at 7:50 pm #264819Tom
Lead DeveloperLead DeveloperThis might help: https://codex.wordpress.org/Post_Formats#Formats_in_a_Child_Theme
-
AuthorPosts
- You must be logged in to reply to this topic.