0

I have the following query along with a custom post type called "Questions":

 <ul>
     <?php 
     $args = array( 
        'post_type' => 'questions', 
        'posts_per_page' => 50 
     );

     $loop = new WP_Query( $args ); 

     while ( $loop->have_posts() ) : $loop->the_post(); ?>
         <li>
            <a href="<?php the_permalink() ?>" rel="bookmark" title="<?php the_title_attribute(); ?>">
                <?php the_title(); ?>
            </a>
         </li>
     <?php 
     endwhile; ?>
 </ul>

I've also created a custom taxonomy called "Type" and linked it to this post type in order to categorize the content (like, type of questions). This query lists all the questions title but I would like to find a way to list the categories this question belongs to so it looks like:

  1. How do I configure my email client? in "Technical Support"
  2. How to change my themes' background image in "Wordpress Support"

I've tried using but I'm not getting any results.

Any ideas?

3

Category is a specific taxonomy built into WordPress, the_category only works with this single taxonomy, not custom taxonomies. To fetch terms from a custom taxonomy, use the_terms:

the_terms( $post->ID, 'type' );
| improve this answer | |

Your Answer

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.