Child Header ID

Function of output of child headings, according to the slug (link to the heading) of their parent:

In functions.php we create a new function cat_children()

<?php function cat_children($arg) { $cat = get_category_by_slug($arg)->term_id;
             $children = get_categories('hide_empty=0&child_of='.$cat);

             foreach ($children as $child) {
                $bc .= $child->cat_ID;
                $bc .= ",";

             $bc .= $cat;
             return $bc;
} ?>

This function takes as an argument a short link of the heading, its slug, and returns the ID of all its children, plus its own, separated by commas. Then, in the right place, just output our function, substituting the required argument:

<?php echo cat_children('news'); ?>

Требуется подобная доработка? Напишите нам.