For reliability, you can get the current term being viewed from the queried object from $GLOBALS['wp_the_query']
$current_term = sanitize_term( $GLOBALS['wp_the_query']->get_queried_object() );
To answer your question, if Southern Africa
is top level, it should have a parent term ID of 0
. All child terms should have a numeric value as parent which corresponds to the parent term id they belong to.
With this in mind, you can simply check the value of $current_term->parent
, and if the value is not 0
, hide your code
$current_term = sanitize_term( $GLOBALS['wp_the_query']->get_queried_object() );
if ( 0 == $current_term ) {
// This is a top level page, show our code
// ADD YOUR CODE HERE
}
Just another tip, I would use get_terms()
for my list