WordPress.org

Ready to get started?Download WordPress

Forums

Single Category Archives (9 posts)

  1. hearsaychris
    Member
    Posted 5 years ago #

    I am breaking into wp and am trying to create custom archives. I have 3 categories, let's say they are A, B, and C. I am wanting to show just the archives of category A on a single page with a custom template. I also want to have a different template to show just the archives of category B. I also need a 3rd for category C. I know I have already created separate category and single post template files.

    How do I call to this specifically from my sidebar and what code needs to be in my archive.php file?

    Thanks for any help you can send my way.

    Chris

  2. MichaelH
    Member
    Posted 5 years ago #

    Just use Category Templates and then WordPress will automatically use the proper template when that Category is clicked say from a list presented by template tag, wp_list_categories().

    Related:
    Stepping Into Template Tags
    Stepping Into Templates
    Template Hierarchy

  3. hearsaychris
    Member
    Posted 5 years ago #

    The catch is that I can't use wp_list_categories().

    Categories A, B, and C are supposed to look like separate sections of the site. There should be no bleed through, meaning the user cannot see anything remotely related to Category B while in Category A and vice versa.

    Right now I am just calling for the standard monthly archives under my sidebar which shows all posts in all categories and that is not what I need.

  4. MichaelH
    Member
    Posted 5 years ago #

    So where are you presenting the link to get to Category A? or Category B, or Category C?

  5. hearsaychris
    Member
    Posted 5 years ago #

    We have a header with links for each Category at the top but we want an archive in the sidebar for each category on it's own category.php file.

  6. MichaelH
    Member
    Posted 5 years ago #

    I still believe my main point about Category Templates applies.

  7. antistandard
    Member
    Posted 5 years ago #

    hi, i want to do the same as hearsaychris, but i find the category template idea confusing not to mention the actual help pages on it.

    i don't see why i can't just make two sidebars A and B,

    then put them both one underneath the other so it may look like :

    --sidebarA--
    pages
    archive 1

    --sidebarB--
    meta
    archive 2

    and then for archive 1 I have :
    <?php wp_get_archives('cat=5'); ?>

    and for archive 2 I have :
    <?php wp_get_archives('cat=1'); ?>

    .......why is wordpress not this simple? seems like a logical and good starting point for me, but alas ..

  8. fisherwebdev
    Member
    Posted 4 years ago #

    You can do exactly what antistandard wants to do if you use this plug-in:

    http://kwebble.com/blog/2007_08_15/archives_for_a_category

    I agree, however, that wp_get_archives() really should have this functionality.

  9. shafee85
    Member
    Posted 4 years ago #

    Thank you fisherwebdev. The plugin helped me sort the same issue.

Topic Closed

This topic has been closed to new replies.

About this Topic