Skip to main content
added 301 characters in body
Source Link
deflime
  • 933
  • 7
  • 9

If you are referring to the categories from the post type post (the blog) then this would do the trick:

For a drop-down: wp_dropdown_categories()

For a list: wp_list_categories()

child_of
Only display categories that are children of the category identified by this parameter. There is no default for this parameter.

<?php 
  // Put the parent category ID in place of 9999
  wp_list_categories// for a drop-down, does not need <select></select> wrapper
  wp_dropdown_categories('child_of=9999');
  // for a list, does need <ul></ul> wrapper
  wp_list_categories('child_of=9999');
?>

If you are referring to the categories from the post type post (the blog) then this would do the trick:

wp_list_categories()

child_of
Only display categories that are children of the category identified by this parameter. There is no default for this parameter.

<?php 
  // Put the parent category ID in place of 9999
  wp_list_categories('child_of=9999'); 
?>

If you are referring to the categories from the post type post (the blog) then this would do the trick:

For a drop-down: wp_dropdown_categories()

For a list: wp_list_categories()

child_of
Only display categories that are children of the category identified by this parameter. There is no default for this parameter.

<?php 
  // Put the parent category ID in place of 9999
  // for a drop-down, does not need <select></select> wrapper
  wp_dropdown_categories('child_of=9999');
  // for a list, does need <ul></ul> wrapper
  wp_list_categories('child_of=9999');
?>
Source Link
deflime
  • 933
  • 7
  • 9

If you are referring to the categories from the post type post (the blog) then this would do the trick:

wp_list_categories()

child_of
Only display categories that are children of the category identified by this parameter. There is no default for this parameter.

<?php 
  // Put the parent category ID in place of 9999
  wp_list_categories('child_of=9999'); 
?>