harjeet singh
Member
Posted 2 years ago #
Hi All,
I am trying to create some custom pages for a wordpress blog where for one of my parent category i want to show just category names of the child categories. That works fine using this code...
<?php if ( is_category(3) ) { wp_list_cats('child_of=3&title_li='); } ?>
Next when i click the child categories i want to have a different template to show posts that are in child category of parent category 3.
I hope its not much confusing...
harjeet singh
Member
Posted 2 years ago #
Achieved what was required using this code ...
<?php $this_category = get_category($cat); ?>
<?php if ($this_category->category_parent == 0) { ?>
<?php $this_category->category_parent = $cat; ?>
<?php } else { ?>
<?php $parent_category = get_category($this_category->category_parent); ?>
<?php
$pid=$parent_category->cat_ID;
if ($pid=='3')
include(TEMPLATEPATH . '/custom_cat.php');
else
?>
But i am not sure if this is the right way to do .... plz provide suggestions
Original topic for the code is ...
http://wordpress.org/support/topic/234220?replies=4
harjeet singh
Member
Posted 2 years ago #
Hey plz someone help ! This isn't working properly. Only works for the first child category...