Created
May 15, 2013 18:50
-
-
Save jonbellah/5586321 to your computer and use it in GitHub Desktop.
Integrating isotope with custom post types - the functions.php code
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
/** Set up custom taxonomy query */ | |
function custom_taxonomies_terms_links() { | |
global $post, $post_id; | |
// get post by post id | |
$post = &get_post($post->ID); | |
// get post type by post | |
$post_type = $post->post_type; | |
// get post type taxonomies | |
$taxonomies = get_object_taxonomies($post_type); | |
foreach ($taxonomies as $taxonomy) { | |
// get the terms related to post | |
$terms = get_the_terms( $post->ID, $taxonomy ); | |
if ( !empty( $terms ) ) { | |
$out = array(); | |
foreach ( $terms as $term ) | |
$out[] = $term->slug; | |
$return = join( ' ', $out ); | |
} | |
} | |
return $return; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment