Category and sub-category list
-
Hi all,
Just have a question as to how to use php queries. Hopefully this will make sense.
On my website I am putting together a page that displays a list of categories (with category images, enabled through a category image plugin).
This is my code at the moment:
<?php foreach (get_categories() as $cat) : ?> <div id="show_onair_box"> <img src="<?php echo z_taxonomy_image_url($cat->term_id); ?>" /> <div id="show_onair_title"> <a href="<?php echo get_category_link($cat->term_id); ?>"> <?php echo $cat->cat_name; ?></a> </div> </div> <?php endforeach; ?>
The only problem is that at the moment all categories on the site are being displayed. I only want to show categories under a particular parent category. Say my parent category had the ID 4, how would I go about specifying this in the code?
If someone could help it would be much appreciated!
Thanks
Viewing 2 replies - 1 through 2 (of 2 total)
Viewing 2 replies - 1 through 2 (of 2 total)
- The topic ‘Category and sub-category list’ is closed to new replies.