How to get children categories name
-
WORDPRESS VERSION: 2.7.1
Hi,
I am trying to get the name of child category whose article get’s printed as the latest one from the Root category. I have a hierarchy of categories in my site e.g.
* ROOT
|- child 1
|- child 2
|- child 3With the following code, WP prints out “Root” category name with an article from one of the children depending which is the latest one:
<?php query_posts("showposts=1&cat=$category"); $wp_query->is_category = false; $wp_query->is_archive = false; $wp_query->is_home = true; ?> <h3><a href="<?php echo get_category_link($category);?>"> <?php // name of each category gets printed single_cat_title(); ?> </a></h3> <?php while (have_posts()) : the_post(); ?> <?php
The function single_cat_title(); prints out the Root category name and I would like to replace it with the name of the child category.
Thanks for your help!
Omer
Viewing 2 replies - 1 through 2 (of 2 total)
Viewing 2 replies - 1 through 2 (of 2 total)
- The topic ‘How to get children categories name’ is closed to new replies.