• Resolved bnfan

    (@bnfan)


    Hi, guys

    Here I encounter one issue, customer need list specific archive according to different category. For example, in the categary A page, only list the archive for the posts in the category A. in the category B page, which shows all the posts in categary A, get the archive links only belong to categary B.

    I read through the wordpress code, found have to change the function wp_get_archives. But I don’t want to change wordpress’s source code.

    Is any other workaround?

    Thank you!

Viewing 8 replies - 1 through 8 (of 8 total)
  • For example, in the categary A page, only list the archive for the posts in the category A.

    The WordPress archiving ability does that naturally, just create a category, assign posts to that category, click on a category link provided by a template tag such as wp_list_categories(), and you are viewing all the posts in that Category.

    Don’t be confused by what an archive is–it is just a generated display of your posts at that moment. You don’t do anything to create the archive, that’s an automatic thing WordPress does for you. Usually, archives are date, category, tag, or author, based.

    Access to archives is typically presented via links in a sidebar under an Archive (date based), Category, or Tag Cloud, heading. Widgets, or Template Tags, such as wp_get_archives(), wp_list_categories(), wp_tag_cloud(), and wp_list_authors(), are the constructs used to present links to users to visit your various archives. The process of placing code in your Theme’s Templates is explained in Stepping Into Templates and Stepping Into Template Tags.

    Once a user clicks on a Category link in the sidebar, the display of those posts can be controlled by a Category Template. Other Templates, such as Author Templates, and Tag Templates, are available if you set them up. These Templates can be coded via Template Tags such as the_title(), the_content(), or the_excerpt(), to display just a post title, the full content of the post, or just an excerpt of the post.

    Also, it is important to understand the Template Hierarchy, as that is how WordPress determines what Template to use to render the posts for reading by your readers.

    If a user visits a Category archive, then clicks on a given post title in that Category archive, the display of that single post is again presented by another Template, and again, the Template Hierarchy determines what Template displays that single post. Finally, that single post Template can be coded to display just the title, the full post content, or an excerpt.

    But just in case this isn’t what you want here’s a Category Archives article: https://www.z-oc.com/blog/2008/03/category-based-archive/

    Thread Starter bnfan

    (@bnfan)

    Thank you MichaelH,

    Here let me clarify my question, we wanna list the archive list base on date and category at the same time. For example, only list the archive links in category A base on their posts’ date.

    The archive links output is as follow:

    February 2009
    January 2009
    December 2008
    November 2008
    August 2008
    July 2008

    But when you click one of them, only the category A’s posts are listed.

    Do we have methods to address this issue?

    Thread Starter bnfan

    (@bnfan)

    We have resolved the isssue by using three filters:

    getarchives_where

    getarchives_join

    clean_url

    Thanks for workpress’ filter mechnism.

    chavo

    (@chavo)

    Hi bnfan. Can you post how did you do that?. I’m looking for the same solution and I can’t find it yet.

    Thanks in advance.

    Yes please can you show us how?

    Bfnan, can you please paste the code you used to solve this in this thread? There are several people wanting this solution.

    Yes, I am also looking to do this. Please bnfan – any way you can post your glorious code to help us all show archives for only a single category?

Viewing 8 replies - 1 through 8 (of 8 total)
  • The topic ‘Do we have the chance get the archive links according to specific category?’ is closed to new replies.