Archived topic
How to create different post template
7 replies · Started by Alessio Angeloro on January 13, 2016
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
Regards
Hi there,
Hmm, did you find somewhere that told you to use this kind of file name?: content-single-%mypostid%.php
I 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 :)
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.
The 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_Page
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.
I believe it should just be:
content-aside.php
content-quote.php
etc..
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
status
Your example (I found in another post) referenced additional types:
gallery
audio
chat
Is 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!
This might help: https://codex.wordpress.org/Post_Formats#Formats_in_a_Child_Theme