WordPress.org

Ready to get started?Download WordPress

Forums

Possible to have 2 styles of single.php? (3 posts)

  1. adejones
    Member
    Posted 11 months ago #

    Hi everyone
    I have a page with a feed of posts from one category, when clicking the permalink of one post it goes to the full post using single.php (obviously).

    I am then going to have another page with a different feed of posts from a different category and I want these full posts (once clicked in to) to have a different style/layout, but this would also be using single.php

    How is it possible to have two different types of single post for the two different categories because obviously there is only one single.php?

    Thanks

  2. Kacomp
    Member
    Posted 11 months ago #

    Hi there,

    You can do this two ways.
    1. Create a new template. Just copy single.php call it something else then make your styling changes withing this file. You can then select this new template from your post/page.
    2. Read about post formats http://www.wphub.com/tutorials/wordpress-post-formats/

    I hope this helps you to find the solution you are looking for.
    Good luck.
    Karen.

  3. paulwpxp
    Font hero
    Posted 11 months ago #

    You can difinitely do that making use of classes produced by body_class(). There is also post_class(), but most of the times body_class() is enough to get the job done.

    http://codex.wordpress.org/Function_Reference/body_class

    http://codex.wordpress.org/Function_Reference/post_class

Reply

You must log in to post.

About this Topic