How to differently style pages that display posts of different category in Wordp

  • Unknown's avatar

    I want to know how to stylize pages that display specific post content in WordPress. For example, if I have categories Horror and Comedy, how to stylize (change template and css) pages in a way that all posts that are members of category Horror be stylized differently for any post from category Comedy? If a page should display post from Horror category, then give me one page style, if a page should display post from Comedy category, then give me the other page style. Thanks in advance.

  • Hi @natttttan!

    Can you post a link to the site you are looking for help with?

    If the site is hosted here at WordPress.com, you’d need Custom CSS (part of a Premium Plan or Business Plan) to make these kinds of changes.

    If your site is not hosted here on WordPress.com (meaning you use a different host to run your site) then you’ll want to post to the community forums at http://WordPress.org/support instead :)

  • Unknown's avatar

    ok thank you, my site is not hosted here, I just want to know how I can do that in principle.

  • Got it :)

    If you inspect your page, you can look at the body tag in particular, as well as the individual post elements (usually those will be the article elements).

    Those will have classes on them that relate to the page in question, usually including categories. You can target those classes with CSS to style them differently

  • The topic ‘How to differently style pages that display posts of different category in Wordp’ is closed to new replies.