Forums

query_posts for year and category, how to keep it dynamic? (10 posts)

  1. elpimsn
    Member
    Posted 1 year ago #

    hi there.
    I'm getting frustrated.. I tried so many things, but nothing seems to work the right way.
    what I'm looking for is something like this:
    i have posts of the news-category. now, I want all of them which are posted in current year (now 2010) appearing on the home/-frontpage. there's also a menupoint "news", which directs to the frontpage.

    additionally, I want submenu-items created dynamically of all past years where news-posts exists, to show all the news-posts of this specific year (submenu-item 2009 shows all news-posts from 2009).
    I tried it with categories for past years, but that's not dynamic at all.

    I tried it with wp_get_archives, but there's no filtering for categories.

    I know I could query_posts, this function accepts a category and a year parameter, but how could I implement this to have both the template and the menu dynamic?

  2. MAS
    Member
    Posted 1 year ago #

  3. elpimsn
    Member
    Posted 1 year ago #

    thanks, that looks good. but:
    where would i have to put the code? into categery-news.php ?
    if so, what would be the best way to tell the loop, which is the year to display the posts from?

  4. MAS
    Member
    Posted 1 year ago #

    yss. put it in categery-news.php file if you want to get all details of news

  5. elpimsn
    Member
    Posted 1 year ago #

    ok, but what about the second question..?

    ..and what about getting the past years as menupoints? how can i set them up properly, in order to get the template file working nicely?

  6. MichaelH
    Volunteer
    Posted 1 year ago #

  7. elpimsn
    Member
    Posted 1 year ago #

    Thank you! The category-based-archives-plugin seems to be a good solution. But there's almost no documentation about it. Only the few template functions are explained.

    This http://mydomain.com/2008/in-category-slug/ doesn't work out of the box. Do I have to change my permalinks-structure? I have /%category%/%postname%, which I really need to keep in fact.

  8. MichaelH
    Volunteer
    Posted 1 year ago #

    Don't know the answer to that so have tagged this so the plugin author might see it...

  9. elpimsn
    Member
    Posted 1 year ago #

    ok, thank you.

    although i doubt that the author will be interested, as he stated on his homepage that he won't do any webdevelopment anymore, it might somebody else out there to give a hint here. it'd be very much appreciated!

  10. elpimsn
    Member
    Posted 1 year ago #

    just found this plugin: archives for a category by kwebble.

    i think i'm going for this one, hope it'll work

Topic Closed

This topic has been closed to new replies.

About this Topic