Created
January 3, 2012 15:21
-
-
Save ptasker/1555319 to your computer and use it in GitHub Desktop.
Cheezcap settings created from a list of terms
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* | |
* Helper for the Cheezcap config array. | |
* | |
* Loops through the terms and categories on the site and creates Cheezcap options for them. | |
* | |
* Used to create Cheezcap options per category/taxonomy | |
* | |
* @param type $term | |
* @param type $slug | |
* @param type $desc | |
* @param type $textarea | |
* @param type $rich | |
* @return CheezCapTextOption | |
* @see config/bl-cheez-config.php | |
*/ | |
function bl_term_cheezies( $term, $slug, $desc = '', $textarea = false, $rich = false ) { | |
$terms = get_terms( $term, array( 'hide_empty' => false ) ); | |
$cheezies = array( ); | |
$ta = $textarea ? true : false; | |
if(!$terms) | |
return $cheezies; | |
foreach ( $terms as $term ) { | |
if ( $rich ) { | |
$cheezies[ ] = new CheezCapRichTextOption( | |
'Term details for ' . $term->name, | |
$desc, | |
$slug.'_' . $term->slug, | |
'', | |
true | |
); | |
} else { | |
$cheezies[ ] = new CheezCapTextOption( | |
'Term details for ' . $term->name, | |
$desc, | |
$slug . '_' . $term->slug, | |
'', | |
$ta | |
); | |
} | |
} | |
return $cheezies; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment