Function:
mp_core_categorized_blog()
Purpose:
This function returns true if a blog has more than 1 category.
Overview:
This is useful when deciding whether to output a list of categories on a post page. Often it will be used with the “get_the_category_list()” function in WordPress.
Usage:
if ( mp_core_categorized_blog() ) { //This blog has more than 1 category so show categories }
//Get the list of categories for this post separated by a comma $categories_list = get_the_category_list( __( ', ', 'textdomain' ) ); //If there is a category list and this blog has more than 1 category if ( $categories_list && mp_core_categorized_blog() ) { //This blog has more than 1 category so show categories }
Returns:
(boolean)
Returns true if the WP blog has more than 1 category. False if there is only 1 or none.