Support » Installing WordPress » Category Templates

  • Resolved Kate


    After reading extensively on Page Templates within the Codex and support forum, I’m under the impression that should I wish to have a particular layout for a particular page, then I should create a specific Page Template for that Page.

    If this is correct, and on this basis, I am to assume then that should I wish to have a particular layout for a particular category, then I would need to create another single.php template and re-name it… articles.php. Is this right?

    I ask this because if I have five special categories for my primary navigation and three require different layouts (ie: widecolumn for articles but narrow column for topics) how will I call these templates when I write posts? I know I have to put some sort of get_function or include function?? in the main.php? to bring them into play when I write a post that is delegated to the category “articles�.

    Can someone please confirm if I need to insert all new category template functions within the main.php in order to call the new template/s or do I not put any function anywhere and WP will automatically call these templates whenever I delegate a post to a particular category.

    Thanks heaps for your invaluable input!


Viewing 7 replies - 1 through 7 (of 7 total)
  • You will need to create the page template and then edit the post or when creating a new one assign it to the page template.

    There is a specific format for the page template.

    Ok. Thanks for your input. – I’ve read that link referral before, but I’ll read it again. Obviously I’ve missed something.

    Just for clarity; I did’t think you could assign Posts to a Page Template. Is this right? In my admin section under “write”/”Post” there isn’t an option to change templates.

    Based on your input, how will I assign a Post to the new “articles.php” template?

    Thanks again. I reallyl do appreciate your help.

    I don’t think you can assign posts to the Page Template. Only pages have that flexibility.

    If you want a specific look for posts (not Pages) in a specific Category you can create a Category-6.php (where your Category is 6). You would be best to use category.php, archive.php, or index.php for the basis of that template.

    Additional info:

    Thanks Ajay, and thanks MichaelH!

    I will look up those threads and read them again. Just of interest, I understand, now, that if I want a particular layout for a specific category, I would need to create a new category.php. Michael, how would I call it into play? Do I need to put another piece of code somewhere to call this layout or will WP just automatically assign this new category.php template whenever I post under associated “category”?

    Thanks again, you’ve helped me considerably.


    It should “put it into play” automatically. The Template_Hierarchy ‘controls’ what template gets used.

    Oh, you’re brilliant! Thank you so much for helping me. Would you believe I’ve been trying to work this out for the last two weeks to no avail?

    Thanks again. I like the fact that WP just calls this template into play without me having to worry about inserting another piece of code to call it.

    Whew! I think I need a diet coke! 🙂


Viewing 7 replies - 1 through 7 (of 7 total)
  • The topic ‘Category Templates’ is closed to new replies.