WordPress.org

Ready to get started?Download WordPress

Forums

Different Format for Different Categories?? Is that possible? (11 posts)

  1. kt83
    Member
    Posted 4 years ago #

    Hi All,

    I'd like to know if it's possible for me to format the article content in different ways for different categories. Like different font size, or include/exclude post date etc.

    Thanks!

  2. cubecolour
    ɹoʇɐɹǝpoɯ
    Posted 4 years ago #

    Yes you can do that. You just have to make separate tempates for any categories which you want to be different.
    http://codex.wordpress.org/Category_Templates

  3. kt83
    Member
    Posted 4 years ago #

    Thanks, Numeeja. I think there's a gap between what I know and what the article talks about.

    So when I create a new category, how do I choose which template to apply to it? I don't see that option...

  4. batrachoid
    Member
    Posted 4 years ago #

    So, if you want to make the Category whose ID number is 6 look different from what it is currently (and different from other Category pages), you would want to create a category-6.php file. If you want to make all Category pages look different from other archive pages (such as date and author archives), then you would want to create or modify the category.php file. If you want to make changes to the look of all archive pages, you can create or modify the archive.php file. And if you modify the index.php file, you will affect your entire blog.

  5. kt83
    Member
    Posted 4 years ago #

    Batrachoid, I read and reread that part, but I still can't figure out how to apply a category to a specific template. In the admin GUI, when I create a new category, there's no option to apply a template to it.

    Sure I can create "category-6.php" but where and how do I specify its use?

    "So, if you want to make the Category whose ID number is 6 look different from what it is currently (and different from other Category pages), you would want to create a category-6.php file."

    I wasn't aware that categories had ID numbers, only slugs.

  6. cubecolour
    ɹoʇɐɹǝpoɯ
    Posted 4 years ago #

    Go to posts -> categories
    When you hover over a category name you should be able to read its numerical ID in the bar at the bottom of the browser.

    if not it is displayed in the address bar when you click the link. Once you have the ID for the category, create your custom template with the appropriate name and WordPress will use it.

  7. s_ha_dum
    Member
    Posted 4 years ago #

    kt83,

    You don't have to apply a template to a category, just create a file with the appropriate name, as described above, and WP will use it.

  8. kt83
    Member
    Posted 4 years ago #

    ok, thanks a lot for all your help

  9. kt83
    Member
    Posted 4 years ago #

    in which folder do I create the category-6.php file? I use customized templates

  10. kt83
    Member
    Posted 4 years ago #

    Ok, I've got the category thing figured out. Thanks.

    Now, how do I edit the homepage so that previews of articles from category-6 look different from previews of articles from the default categories? I'm talking about the homepage where the most recent articles are previewed.

    for example: for category-6 articles, I want a date to appear right under the title, but not for other categories.

  11. kt83
    Member
    Posted 4 years ago #

    So I've now customized categories, can I customize the articles in those categories?

Topic Closed

This topic has been closed to new replies.

About this Topic

Tags

No tags yet.