I've searched this question a lot, but all I find is answers of how to show every category for a specific taxonomy.
I'm developing a theme, and I'm going to filter a list of posts (custom post type 'jobs') using jQuery, but I need to have a <div>
with a class showing the categories of that specific post.
I'm going to filter these on the category page (jobs).
For this to work, I'm putting all my code in the loop.php.
<div class="post_entry">
<div class="post-thumb"><?php the_post_thumbnail('single-post-thumbnail'); ?></div>
<h4 class="post-title"><a href="<?php the_permalink(); ?>" title="<?php printf( esc_attr__( '%s', 'twentyten' ), the_title_attribute( 'echo=0' ) ); ?>" rel="bookmark"><?php the_title(); ?></a></h4>
<?php
$location = get_post_meta($post->ID, 'location', TRUE);
$organization = get_post_meta($post->ID, 'organization', TRUE);
$url = get_post_meta($post->ID, 'url', TRUE);
?>
<div class="post-meta">
<?php if($organization != ''){ ?><p class="post_meta_organization"><?php echo $organization; ?></p><?php } ?>
<?php if($location != ''){ ?><p class="post_meta_location"><?php echo $location; ?></p><?php } ?>
<?php if($url != ''){ ?><p class="post_meta_url">Website: <a href="<?php echo $url; ?>">Click Here</a></p><?php } ?>
</div>
<div class="hidden tags">
</div>
<?php if ( is_archive() || is_search() ) : // Only display excerpts for archives and search. ?>
<p class="post_excerpt"><?php the_excerpt(); ?></p>
<?php else : ?>
<div class="category_read_more"><?php the_content( __( 'Read More', 'twentyten' ) ); ?></div>
<?php wp_link_pages( array( 'before' => '' . __( 'Pages:', 'twentyten' ), 开发者_C百科'after' => '' ) ); ?>
<?php endif; ?>
<?php edit_post_link( __( 'Edit', 'twentyten' ), '', '' ); ?>
<?php comments_template( '', true ); ?>
</div>
I've been lucky to add meta-box information, but I want to show the posts custom categories (jobtype) in <div class="hidden tags"></div>
To take a look at the website, check out http://www.cirkut.net/wp/libertyguide/jobs
If anyone could help, that would be fantastic! If any more information is needed, let me know.
In the loop:
Category: <?php echo get_the_category_list(', '); ?>
Update:
Wordpress writes:
Listing the terms
If you want to have a custom list in your theme, then you can pass the taxonomy name into the the_terms() function in the Loop, like so:
the_terms( $post->ID, 'people', 'People: ', ', ', ' ' );
This should address your problem.
http://codex.wordpress.org/Taxonomies#Listing_the_terms
精彩评论