frontend/web/blog_mysql/wp-content/themes/v20190812/inc/template-tags.php
/**
 * Returns true if a blog has more than 1 category
 */
Returns true if a blog has more than 1 category
Returns true if a blog has more than 1 category
function sirat_categorized_blog() {
	if ( false === ( $sirat_all_the_cool_cats = get_transient( 'sirat_all_the_cool_cats' ) ) ) {
		$sirat_all_the_cool_cats = get_categories( array(
			'hide_empty' => 1,
		) );
		$sirat_all_the_cool_cats = count( $sirat_all_the_cool_cats );
		set_transient( 'sirat_all_the_cool_cats', $sirat_all_the_cool_cats );
	}
	if ( '1' != $sirat_all_the_cool_cats ) {
		return true;
	} else {
		return false;
	}
}
function sirat_categorized_blog ( ) { if ( false === ( $ sirat_all_the_cool_cats = get_transient ( 'sirat_all_the_cool_cats' ) ) ) { $ sirat_all_the_cool_cats = get_categories ( array ( 'hide_empty' => 1 , ) ) ; $ sirat_all_the_cool_cats = count ( $ sirat_all_the_cool_cats ) ; set_transient ( 'sirat_all_the_cool_cats' , $ sirat_all_the_cool_cats ) ; } if ( '1' != $ sirat_all_the_cool_cats ) { return true ; } else { return false ; } }
Returns true if a blog has more than 1 category
Returns true if a blog has more than 1 category
// Create an array of all the categories that are attached to posts // Count the number of categories that are attached to the posts // This blog has more than 1 category so sirat_categorized_blog should return true // This blog has only 1 category so sirat_categorized_blog should return false