skt_pathway_categorized_blog

Returns true if a blog has more than 1 category.

Description

skt_pathway_categorized_blog(); 

Usage

  1. if ( !function_exists( 'skt_pathway_categorized_blog' ) ) { 
  2. require_once '/inc/template-tags.php'; 
  3.  
  4.  
  5. // NOTICE! Understand what this does before running. 
  6. $result = skt_pathway_categorized_blog(); 
  7.  

Defined (1)

The function is defined in the following location(s).

/inc/template-tags.php  
  1. function skt_pathway_categorized_blog() { 
  2. if ( false === ( $all_the_cool_cats = get_transient( 'all_the_cool_cats' ) ) ) { 
  3. // Create an array of all the categories that are attached to posts 
  4. $all_the_cool_cats = get_categories( array( 
  5. 'hide_empty' => 1,  
  6. ) ); 
  7.  
  8. // Count the number of categories that are attached to the posts 
  9. $all_the_cool_cats = count( $all_the_cool_cats ); 
  10.  
  11. set_transient( 'all_the_cool_cats', $all_the_cool_cats ); 
  12.  
  13. if ( '1' != $all_the_cool_cats ) { 
  14. // This blog has more than 1 category so skt_pathway_categorized_blog should return true 
  15. return true; 
  16. } else { 
  17. // This blog has only 1 category so skt_pathway_categorized_blog should return false 
  18. return false;