How to get custom post type taxonomy posts
-
Hello all, I’m having some trouble displaying the posts in a custom post type on my taxonomy page, and I’m wondering if someone can help.
Here’s the deal. I have a custom post type called ‘workshops.’ Within that custom post type, I have a custom taxonomy called ‘age’, ‘schedule’, ‘groups’, ‘session’ where I have created several categories. I set up a template called taxonomy.php which governs mydomain.com/work as well as mydomain.com/project-type/print-design/. The problem is that there is displaying all the posts, I need them to display all the posts in the proper category (or in the case of mydomain.com/work, all of the posts in the custom post type regardless of category). How can I modify this code to display all of the posts?
like this:
texonomy name then:
Post1
Post2texonomy name2 then:
if have the post print here other wise no post will be show.texonomy name3 then
Post1
Post2
Post3Please here..
Here is the code I have used for taxonomy.php:
<h2><?php single_cat_title(); ?></h2> <?php echo $taxonomy_id=get_queried_object()->term_taxonomy_id; ?> <?php if (have_posts()) : ?> <?php while (have_posts()) : the_post(); ?> <section id="post-<?php the_ID(); ?>" class="post clearfix"> <div class="details"> <h3><?php $terms_as_text = get_the_term_list( $post->ID, 'session', '', ', ', '' ) ; echo strip_tags($terms_as_text); ?><?php $terms_as_text = get_the_term_list( $post->ID, 'schedule', ' (', '', ')' ) ; echo strip_tags($terms_as_text); ?></h3> <h3><?php $terms_as_text = get_the_term_list( $post->ID, 'groups', '', ', ', '' ) ; echo strip_tags($terms_as_text); ?></h3> <?php if(has_post_thumbnail()) : ?> <div class="row"> <div class="featured-image pull-left"> <?php the_post_thumbnail('workshop-details-thumb'); ?> </div> <!-- featured-image pull-left --> <div class="details-conent pull-left"> <h3><a href="<?php the_permalink(); ?>" title="<?php the_title(); ?>"><?php the_title(); ?></a></h3> <?php echo excerpt(40); ?> <?php if( $cfs->get('shop') != 1 ) { echo $cfs->get('field_name'); } else { echo '<h4><span><a href="#">Shop</a></span><div style="color: #00626c">Book published from this workshop</div></h4>'; } ?> </div> </div> </div> <?php else : ?> <?php endif; ?> </section> <!-- end div #post --> <?php endwhile; ?> <?php include (TEMPLATEPATH . '/includes/pagenav.php'); ?> <?php else : ?> <p>Sorry, but the page you are trying to reach is unavailable or does not exist.</p> <?php endif; ?>
- The topic ‘How to get custom post type taxonomy posts’ is closed to new replies.