WordPress.org

Ready to get started?Download WordPress

Forums

Templates for posts? (5 posts)

  1. Rob Cubbon
    Member
    Posted 3 years ago #

    Can you create templates for posts in WordPress similarly to creating different templates for pages?

    I would like to be able to display single posts in certain ways (with a certain template) having elements before and after the post and the ability to change the post type at a later date.

  2. flamenco
    Member
    Posted 3 years ago #

    Yes. If you're seeing that your Pages look just like your Posts, then chances are you don't have a Page template (page.php).

    Most decent templates will have a template for Posts (single.php), and a template for Pages (page.php). They may give them various names, but those are the actual files, which you can see in Appearance... Edit.

    So you can edit page.php, or if you don't have one, you'll have to make one. Or simply try a different theme. :)

    WordPress themes are very alterable, but somewhat complex. More info here.
    http://codex.wordpress.org/Theme_Development

    Good luck, D

  3. Rob Cubbon
    Member
    Posted 3 years ago #

    I flamenco, I explained this really badly. Apologies.

    I have a single.php and page.php in this theme. What I meant was whether I could get post A and B to look different in the same way as you can get page A and page B to look different with page templates.

    But I think I can do this with categories. I can use conditional tags in single.php to say "if it is this category do this" "if it is that category do that" etc., an assign categories to posts that I want to look a certain way when viewed with single.php.

  4. flamenco
    Member
    Posted 3 years ago #

    Gotcha. Being a CSS guy, I like to alter the look, colors, and other stuff with that - then I don't have to touch PHP, and I can do stuff for categories, or even individual posts. :) Themes are usually set up laden with classes and ID's, so this works very well.

    I like your Categories "IF" idea. That would also be great; you can mess with HTML all you want, which my approach doesn't allow (apart from vanishing parts of it). I'm sure there are other ways, too.

  5. Rob Cubbon
    Member
    Posted 3 years ago #

    It'll be PHP and HTML – I don't much understand it but there are some pointers in the codex and I get there with trial and error. Cheers.

Topic Closed

This topic has been closed to new replies.

About this Topic

Tags