我已经搜索了很多这个问题,但我发现的只是如何显示特定分类的每个类别的答案。
我正在开发一个主题,我将使用 jQuery 过滤帖子列表(自定义帖子类型“工作”),但我需要一个<div>
带有显示该特定帖子类别的类。
我将在类别页面(工作)上过滤这些。
为此,我将所有代码都放在 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' ), 'after' => '' ) ); ?>
<?php endif; ?>
<?php edit_post_link( __( 'Edit', 'twentyten' ), '', '' ); ?>
<?php comments_template( '', true ); ?>
</div>
我很幸运添加了元框信息,但我想在中显示帖子自定义类别(jobtype)<div class="hidden tags"></div>
要查看该网站,请查看http://www.cirkut.net/wp/libertyguide/jobs
如果有人可以提供帮助,那就太好了!如果需要更多信息,请告诉我。