1

Hey there & merry Christmas Experts :-),

if want to have the following Scenario: Custom Post Type "Portfolio" with Tags (Filters) and Categories (Portfolio Groups)

Let's say a 1. Webdesign Category with Tags (for Filters) PHP, HTML, CSS 2. Photography Category with Tags (for Filters) Animals, Landscape

Now I can choose in the Backend from a Metabox from which Category/Categories I want to show the Portfolio. (That's what I have so far)

I Struggle with the Frontend: In the Frontend I now have to Pull the Tag-List from the chosen Portfolio Categories.

Then Pull the entries (title, permalink, ...) from the chosen Categories and display the appropriate tags.

Custom Post Type is called: portfolio Portfolio Tags called: portfolio_tag Portfolio Categories called: portfolio_category

That's what I have so far: Tags don't get pulled by selected categories, instead from all categories :/....

<div id="filters">
   <ul>
       <?php $tags = get_categories('taxonomy=portfolio_tag&title_li=');
       foreach ($tags as $tag){ ?>
           <li><a href="#" data-filter=".term-<?php echo $tag->name;?>" title="<?php echo $tag->count;?> <?php _e('Items', 'minti'); ?> "><?php echo $tag->name;?></a></li>
       <?php } ?>
   </ul>
</div>

// Array of selected categories: 
// wp_get_object_terms( get_the_ID(), 'portfolio_category'

I'm searching for the easiest, cleanest way to do this and I'm a PHP noobie :-)

Hope you can help me out. Thanks

  • Please clarify if you are talking about real tags and categories or custom taxonomies. – fuxia Dec 25 '12 at 2:37
  • About Custom Post Type Tags and Custom Post Type Categories, if that helps more.. – Jason Dec 25 '12 at 11:11
  • So you want to reuse the built-in tags and categories? You don’t use register_taxonomy()? – fuxia Dec 25 '12 at 11:19
  • Well I want to query the tags from specific categories, let's say with the slugs webdesign, photography – Jason Dec 26 '12 at 0:11

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.