我已經搜索了很多這個問題,但我找到的是如何顯示特定分類標準的每個類別的答案。在自定義帖子列表中顯示帖子的分類
我正在開發一個主題,我將使用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
如果有人可以幫忙,那太棒了!如果需要更多信息,請告訴我。
這是行不通的。我正在使用自定義分類。爲了澄清一點,我需要在空格分隔的列表中顯示類別(例如'web-dev職業全職'而不是'web/dev,職業,全職) –
我已經更新了答案。現在希望你在找什麼。 –