Category depth function with get_categories
-
On a parent category archive page – I want to have a listing of child level categories only (not grandchild, or great grad child – so a depth of 1), with the category description below. I’m using this PHP function for that:
<div class=”cat-display”>-
<?php
- ‘ . $title . ‘term_id ) . ‘” title=”‘ . sprintf( __( “View all posts in %s” ), $term->name ) . ‘” ‘ . ‘>’ . $term->name.’
$currentcat = get_query_var(‘cat’);
$categories=get_categories(‘child_of=3’);
if ($categories) {
foreach($categories as $term) {
echo ‘‘;
echo ‘<p>’ . $term->description .'</p>’;
}
}
?></div>
But I don’t know how to limit the depth to 1 – can anyone help?
the URL in question:
https://www.artbrain.org/category/journal-neuro-aesthetic-theory/Thanks!
Viewing 3 replies - 1 through 3 (of 3 total)
Viewing 3 replies - 1 through 3 (of 3 total)
- The topic ‘Category depth function with get_categories’ is closed to new replies.