wordpress 自定义分类项目归档页数据调取实例

<h2>分类本身的数据 </h2>
<p><?php print_r(get_queried_object()); ?></p>

<h2>常规分类获取 </h2>
<p><?php $item = get_queried_object(); ?></p>
<p>分类网址<?php echo get_term_link($item->term_id); ?></p>
<p>分类名称<?php echo $item->name; ?></p>
<p>分类id<?php echo $item->term_id; ?></p>
<p>分类别名<?php echo $item->slug; ?></p>
<p>分类类型名称<?php echo $item->taxonomy; ?></p>
<p>分类下项目总数<?php echo $item->count; ?></p>

<h2>自定义分类获取 </h2>
<p><?php echo get_term_meta($item->term_id,'product_price',true); ?></p>
<p><?php $term = get_term_meta($item->term_id,'product_thumb',false); ?></p>
<?php foreach($term as $item): ?>
<p><img width="50px" src="<?php echo $item['guid']; ?>" alt=""></p>
<?php endforeach; ?>
<hr>

<?php if(have_posts()): ?>
    <?php while(have_posts()): the_post() ?>
   <?php the_title(); ?>
   <?php the_content(); ?>
<?php endwhile; ?>
<?php endif; ?>
<?php $img =  get_post_meta(get_the_ID(),"other_pic", false); ?>
     <?php foreach( $img as $imgId ): ?>
     <?php echo wp_get_attachment_image($imgId['ID'],'thumb'); ?>
<?php endforeach; ?>

这是标准的获取图片的信息,可获得多个