WordPress.org

Ready to get started?Download WordPress

Forums

[resolved] Help with making a Category Templates. (9 posts)

  1. Ken101
    Member
    Posted 8 years ago #

    I am at a loss on how to create a category template for 1 category in wordpress 2.0.2.
    I have seperated the site into 2 sections,
    1. pages and 2. posts.
    I am currently using "Permalinks" with this value:
    /%category%/%postname%.html
    I have searched 3 days now and found nothing. The question is, I simply want to create category template for the page category. I sure it exists but I failed to find the answer. Any help would be great.
    I have tried the following:
    Suppose the Category ID of the Category in question is 6. WordPress uses the first Template file it finds in your current Theme's directory from the following list.

    category-6.php
    category.php
    archive.php
    index.php

    Worked great with the default structure ".com/?p=123" but fails to work with the permalinks. I have searched pretty much every plugin and failed to find a fix.
    If anyone can point me to a plugin or fix to this issue, it would be wonderful.

    Thanks to anyone who can help.

  2. petit
    Member
    Posted 8 years ago #

    If by "pages" and "posts", you really mean categories for Posts, you should be able to create different template files for the two categories, using the pattern you refer to.
    See Category Templates

    On the other hand, if the pages category contains pages of the Page type, there is a description in the Codex on how to create and use templates for Pages.

  3. Ken101
    Member
    Posted 8 years ago #

    Thank you for the reply but let me explain myself a little better.
    The content of the category I wish to create is irrelevant at the moment.

    It is very simple thing I need to accomplish,

    **I wish to put in place, a template for a specific category.**

    It's as simple as that, but I am not capable of finding the documentation for this.
    Reason being, I am using Permalinks and not the standard structure so it doesn't work.
    Please don't reply with a link to this page codex.wordpress.org/Category_Templates
    I am fully aware of this page and have carefully read it about a dozen times looking for an answer to my question but I can't seem to find it.
    I have created the template but am unable to have the category pull in this specific template when viewed.
    The question once again to be very clear, how to use a template for a specific category.
    I have tried naming the category template:
    category-7.php - as 7 is the category ID. no good
    category-reference.php - as "reference" is the category name. no good
    I have also tried:
    reference.php
    7.php
    7-reference.php and more.
    I have wasted numerous hours trying to find this answer, but am not able to. I am sure the answer is under my nose but I just don't have the energy any more to look for it so I am hoping someone here can make my weekend grand by pointing it out to me.

    I would be ever so grateful...

    Thanks

  4. petit
    Member
    Posted 8 years ago #

    Right! I don't seem to get you the relive during the weekend.
    I'm not going to point you to that page again, but I'm a bit surprised that it doesn't work. WordPress should pick up a category-6.php template for that category, independent of permalink structure.

    I'll get back to you if I find something. Maybe someone else here have seen this problem and have a solution.

    In the meantime I'm curious about what type of difference you want between the "normal" categories and your special category.

  5. Ken101
    Member
    Posted 8 years ago #

    Thanks for the thought petit,
    As per the category-6.php not working, I have tried many times and cannot get it to work, at first I thought it was my cache of the page but still didn't work after clearing the cache, so that wasn't the problem.

    As per the categories, it is just like any other category when it comes down to the wordpress scheme. The only difference that I will be using it for is all articles posted that will not be commented on. More like a my version is the only version articles.(lol) It will be purely information articles on a certain subject.

    Thanks again.

  6. Kafkaesqui

    Posted 8 years ago #

    I'm not sure I fully understand the problem here, but if you're trying to provide a template to posts within a category, and not just a template for the category, then take a look at my plugin:

    http://guff.szub.net/2005/07/21/post-templates-by-category/

  7. Ken101
    Member
    Posted 8 years ago #

    thanks for the reply Kafkaesqui, but a custom templates for all posts is not really what I am looking for. I have failed to catch the fact that to force a template on a category, there must be a (post) not a page posted on that category which makes it take effect. silly me, as that category is created to hold only pages and no posts. I am hoping I can bi-pass this somehow but failed to find the answer up to now. I am still trying to force a template on a category with no posts - if anyone can help, it would be great.

    I am also stuck on a way to import page info similar to post info on said category page.

    eg.
    A post is displayed as follows
    ******************************
    TITLE
    CATEGORY
    SHORT DESCRIPTION
    ******************************
    I am at a loss to find the code to do similar with pages.
    Using the following code supplies the clickable titles which is great but no description.

      <?php wp_list_pages('sort_column=menu_order&title_li='); ?>

    If anyone has an answer to this one also, that would be wonderful.

    Any help would be great...
    Thanks

  8. moshu
    Member
    Posted 8 years ago #

    as that category is created to hold only pages and no posts

    This doesn't really make sense since Pages do NOT have categories.

  9. Ken101
    Member
    Posted 8 years ago #

    I guess I should have read the basic concept of it before installing wordpress.

    Your absolutely right, I don't know what I was thinking, I'm such a schmuck.

    Thank you for showing me the light. Must be those 18 hour work days zapping my brain cells...

    It seems so much clearer now.

Topic Closed

This topic has been closed to new replies.

About this Topic