I don’t understand. Do you mean you want only one specific post and only that one post to be formatted differently? Or do you mean that you want the top static post whatever it may be to be formatted differently? Or do you mean that you want one post to show up on a page by itself and be formatted differently?
One post will be stickied to the homepage. That one post I want to have a different template/design than the rest of the posts. On all other pages, that post will not appear.
You can apply style conditionally using the is_sticky() Conditional tag. Use it to add an additional class to your sticky post’s <div>. I kinda expected that WP would have done this but it looks like it doesn’t.
It does if you use <div <?php post_class();?>> in your templates instead of <div class="post">.
esmi, good to know. Thanks.
Ok so using the is_sticky() how would I modify the index.php so that it says:
If is_sticky()
–display THIS html–
else if
–display this OTHER html–
I grasp the concept but I’m not 100% sure how to write the proper code. Thanks!
Nevermind I think I figured it out! So far it looks good! 🙂 Thanks for all the help!
Yes, but as esmi pointed out if you use post_class() in your templates you may save yourself some trouble.
I want to do something similar but not sure how…
Basically I want specific posts to use specific templates.
Like a page would use a specific template.
Is this possible?
so post id 1271 uses the custom template 1271.php
Make sense?
If you want to format some posts differently you can filter based on $post->ID and you wouldn’t have to actually create a new template.
You can also just reformat the post using CSS if you know the post IDs.
If you do want to use a radically different template altogether– different header, different footer etc– then filter based on $post->ID and redirect before get_header() and I think you’ll be okay. But I’ve never really thought about this before, much less actually try to do it.