Forums

Please help: sorting posts by subcategory (2 posts)

  1. donovan67
    Member
    Posted 2 years ago #

    My first try asking for help on this one sank without a trace. Maybe my post was too long? Not sure how to ask about what I'm stuck on:

    Building custom blog to display albums released by year. Primary categories exist for each year (1955, 1956, etc.) Within each primary category (year) are subcategories representing each month of that year.

    Posts (album descriptions) are assigned to both a year (primary category) and a month (subcategory). User navigates by selecting year (in sidebar) and seeing all albums released in that year.

    Have been able to accomplish this customization EXCEPT that posts returned are NOT sorted by month. Example:

    http://www.groovydiscs.com/?cat=13

    This looks right until you see the last album posting, which is November, and should appear before the December entries. Current sort order seems to be by post entry.

    (Note: Subcategories (months) are actually labeled as (01) January, (02) February, etc. in order to facilitate sorting. The number prefix is masked in display.)

    I am using the Custom Query String plugin in order to return all posts for Archive display and sort by category. I assumed that this sort would take into consideration the existence of subcategories and consider them in the sort criteria, but it apparently does not.

    I looked at the data tables, and I see that the post_category field in wp_posts is 0 (zero) for all of these posts, and the relationship between posts and categories is only defined in the wp_post2cat table. The categories table seems to contain the switch to indicate whether a category is child or parent (category_parent field). Could this be utilized somehow?

    I've spent a good number of hours searching through the WordPress php code looking for the right place to modify the relevant query, but I'm ready to give up and ask for help. Any assistance would be GREATLY appreciated. Thank you.

  2. pramodd
    Member
    Posted 2 years ago #

Topic Closed

This topic has been closed to new replies.

About this Topic