I cant find the code to simply list all the (custom-post-type)titles with links in a particular custom taxonomy.
For instance, I want to have a list of associated posts in a particular category but the category is a custom taxonomy and the posts are a custom post type. What would be the code to list just titles with links from the associated category?
Also, is there a way to define the current category in a custom taxonomy? Let’s pretend that there is always only one category in each taxonomy associated with each post. I want to define the current category within a defined custom taxonomy… then list all it’s contents. Is there a way to do that?
These custom posts/taxonomies have me scratching my head a bit…. lol!
i was thinking of modifying this bit… any suggestions?
// Get the selected terms for the post (if has more than one use the first)
$term = wp_get_object_terms($post->ID, 'Filters');
if ( $term ) { $term = $term[0]; }
//now you can use $term->slug, $term->name, $term->term_id, etc
<?php $term = get_term_by( 'slug', get_query_var( 'term' ), get_query_var( 'taxonomy' ) );
query_posts($query_string . "&cat=".$term->term_taxonomy_id);
?>
Ok so how do i edit this to display the posts in the custom taxonomy?
ok figured it out. wasnt displaying becuase of the php function above it in the template.
this is solved.
ok i was wrong I cant get this to work anybody have a snippet of code for this?
The code below lists out all the terms in the taxonomy, but Id like to list only the associated post-types in the CURRENT category. In this case my taxonomy is “courses” and I just want to define the current term in “courses” and list the rest of the pages accordingly.
any clues how to accomplish this?
<li id="brands" class="widget-container">
<?php $cam_brands = get_terms('courses', 'hide_empty=1'); ?>
<ul>
<?php foreach( $cam_brands as $brand ) : ?>
<li>
<a href="<?php echo get_term_link( $brand->slug, 'courses' ); ?>">
<?php echo $brand->name; ?>
</a>
<ul>
<?php
$wpq = array( 'post_type' => 'portfolio-item', 'taxonomy' => 'courses', 'term' => $brand->slug );
$brand_posts = new WP_Query ($wpq);
?>
<?php foreach( $brand_posts->posts as $post ) : ?>
<li>
<a href="<?php echo get_permalink( $post->ID ); ?>">
<?php echo $post->post_title; ?>
</a>
</li>
<?php endforeach ?>
</ul>
</li>
<?php endforeach ?>
</ul>
</li>
I need to do the same, isaachorton did u find a solution?