WordPress.org

Ready to get started?Download WordPress

Forums

Templates - Using Category specific Posts and Archives (6 posts)

  1. iaineach
    Member
    Posted 7 years ago #

    I'm trying to modify a template so that all dynamic info will be category specific and will only be visible in the relevant categories.

    I've been using category-6.php etc for the category pages which works fine. However, a post listing reverts to index.php. Also I want the monthly archive (in the sidebar) to be category specific.

    Any help would be greatly appreciated as my php skills are rudimentary at best.

  2. moshu
    Member
    Posted 7 years ago #

    However, a post listing reverts to index.php
    I am not sure I understand this...

    Also I want the monthly archive (in the sidebar) to be category specific.
    WP doesn't provide that feature out of the box.
    There were several attempts to do it - search the forums; I can't remember a sure solution for it, which doesn't mean it doesn't exist :)

  3. iaineach
    Member
    Posted 7 years ago #

    Thanks moshu.

    A post listing reverts

    Excuse my terminology. If I go into a category which uses a category specific template and then click on a post I presumed the post would use this same template. But it uses index.php instead.

    Also I searched the forums but the best I could find was a link to Custom Query String but I'm not sure how to use it.

  4. moshu
    Member
    Posted 7 years ago #

    OK.
    No, single post view does NOT "inherit" the category's template.
    It uses single.php or index (see Template Hierarchy).
    Workaround:
    http://guff.szub.net/2005/07/21/post-templates-by-category/
    (on the same page another plugin, the "inheritor" is also mentioned)

    CQS will not do what you want.
    As I said: I can't remember any working solution for category archives by months.

  5. iaineach
    Member
    Posted 7 years ago #

    thanks again, if I get a solution I'll post a link to it.

  6. raduma
    Member
    Posted 6 years ago #

    iap, i have the same problem.

    i used this post-templates-by-category plugin, but i have a problem: it does not keep the parent/child category when i try to view a post, it uses the index...

    i created for example category-14, which is one of the parent categories, and indeed, when i click a child of this categ, it keeps the template. but vhen i try to view on of the posts in any child of c..-14, it does not use the template.

    how can i keep the template when i view the posts? or what else can i do?

Topic Closed

This topic has been closed to new replies.

About this Topic