query_posts for year and category, how to keep it dynamic?
-
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?
-
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?yss. put it in categery-news.php file if you want to get all details of news
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?
Category mixed with data archives not so easy — for instance http://sltaylor.co.uk/blog/wordpress-category-archives-by-date/
Related:
http://wordpress.org/extend/plugins/wp-category-archive/
http://wordpress.org/extend/plugins/category-based-archives/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.
Don’t know the answer to that so have tagged this so the plugin author might see it…
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!
just found this plugin: archives for a category by kwebble.
i think i’m going for this one, hope it’ll work
- The topic ‘query_posts for year and category, how to keep it dynamic?’ is closed to new replies.