Created
October 6, 2011 21:59
-
-
Save contempoinc/1268817 to your computer and use it in GitHub Desktop.
Output all term slugs for a particular post type in WordPress
This file contains hidden or 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
<?php | |
/** | |
* Output all term slugs for a particular post type | |
* | |
* @author Chris Robinson | |
* @link http://contempographicdesign.com | |
*/ | |
function ct_terms() { | |
if(is_post_type_archive('portfolio')) { | |
$terms = get_the_terms( $post->id, 'portfolio_tags' ); | |
} | |
if ($terms) { | |
foreach($terms as $term) { | |
echo $term->slug; | |
} | |
} | |
} ?> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment