I've been trying to create a Monthly/Yearly archive list for Children categories belonging to a specific Parent category without success.
<?php wp_get_archives(); ?> does not allow you to pass category parameters without the use of this plugin: [[LINK href="http://kwebble.com/blog/2007_08_15/archives_for_a_category"]]HERE[[/LINK]] which modifies the Wordpress core.
However even then it only allows you to specify Categories (one by one). But that's not practical as new Children categories will be created regularly which belong to a Parent category. It would be easier to specify something like "child_of=ID" but I am at a loss where and how else to achieve this..
Ryan Riatno answers:
Have you tried [[LINK href="http://scribu.net/wordpress/smart-archives-reloaded"]]Smart Archives Reloaded[[/LINK]] ?
I did and I could not seemingly get it to work as it's giving me an archive list for the entire site,
<?php smart_archives('cat=97'); ?>
<?php smart_archives('child_of=97'); ?>
Doesn't seem to make a difference unless I am inputting the parameters incorrectly.
Ryan Riatno comments:
Well then, forget about the plugin. You want to group the post based on the category?
If so you can take a look at this [[LINK href="http://rhymedcode.net/1001-wordpression-loops/grouped-by-category/"]]tutorial[[/LINK]].
Not quite what I am looking for. I believe I was on the right path with Smart Archives.
I need to generate month/year archive links for child categories belonging to a parent category only.
Just Me answers:
Did you try putting the category id's you need in a variable and work with that in a loop or something?
Seems you can use <?php wp_list_categories( $args ); ?> by setting the child_of and echo option.
Hi Just Me,
I am doing this:
To generate a list of Children categories of the Parent Category (ID 97) but above I am trying to generate an archive list of these same Children Categories and I'm not sure if wp_list_categories applies in this instance.
Just Me comments:
I was more thinking of something like
<?php $wanted_categories = wp_list_categories( echo=1&child_of=97..... ); ?>
Then use the $wanted_categories variable in a loop.
Navjot Singh answers:
You are entering category ids in the wrong way for Smart Archives plugin mentioned by Ryan. Check this post on how to correctly include categories to show the archives: [[LINK href="http://wordpress.org/support/topic/plugin-smart-archives-reloaded-include-instead-of-exclude-categories"]]http://wordpress.org/support/topic/plugin-smart-archives-reloaded-include-instead-of-exclude-categories[[/LINK]]
This still doesn't let me get the Children Categories of Parent Category with ID=97 though.. thanks for the link however...