Ask your WordPress questions! Pay money and get answers fast! Comodo Trusted Site Seal
Official PayPal Seal

Archive for Children of Parent Category WordPress

Hi,

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..

Any thoughts?

Thank you.

Answers (4)

2011-05-02

Ryan Riatno answers:

Have you tried [[LINK href="http://scribu.net/wordpress/smart-archives-reloaded"]]Smart Archives Reloaded[[/LINK]] ?


Wordpressing comments:

Hi Ryan,

I did and I could not seemingly get it to work as it's giving me an archive list for the entire site,

I've tried,

<?php smart_archives('cat=97'); ?>

<?php smart_archives('child_of=97'); ?>

Etc

Doesn't seem to make a difference unless I am inputting the parameters incorrectly.

Any idea?


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]].


Wordpressing comments:

Hi,

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.

2011-05-02

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.

http://codex.wordpress.org/Template_Tags/wp_list_categories


Wordpressing comments:

Hi Just Me,

I am doing this:

echo wp_list_categories('orderby=id&show_count=1&use_desc_for_title=0&child_of=97')

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.

2011-05-02

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]]


Wordpressing comments:

This still doesn't let me get the Children Categories of Parent Category with ID=97 though.. thanks for the link however...

2011-05-02

Khanh Cao answers:

Can you make it $25?