The following code displays the sub pages of a main page whether you are on the main page or a sub page.
I want to adapt it to show sub categories whether on the category page or the sub category page. The second set of code is where I am stuck.
Thanks for any help!!!
<?php
//if you are on a page NOT a cat
if ($post->ID) {
//if you are on the sub page display the parents sub pages
//if you are on a page display the sub pages
if($post->post_parent)
$children = wp_list_pages("title_li=&child_of=".$post->post_parent."&echo=0");
else
$children = wp_list_pages("title_li=&child_of=".$post->ID."&echo=0");
if ($children) { ?>
<ul>
<?php echo $children; ?>
</ul>
<?php }} ?>
<?php
if ($_GET[cat]) {
if($post->post_parent) //what is the category equivalent??
$children = wp_list_categories("title_li=&child_of=".$post->post_parent."&echo=0");
else
$children = wp_list_categories("title_li=&child_of=".$_GET[cat]."&echo=0");
if ($children) { ?>
<ul>
<?php echo $children; ?>
</ul>
<?php }} ?>