I am retrieving posts from my Custom Post Type using the built-in Wordpress get_posts()
function. I am able to print/retrieve all of the data for the post except the post's taxonomy term (which I registered as a custom taxonomy using register_taxonomy( 'developer_category', 'developer', $args );
Here's my code for displaying the posts...
<?php $devs = get_posts([
'post_type' => 'developer',
'posts_per_page' => '8',
'orderby' => 'rand'
]); ?>
<div id="loaded-devs">
<?php $post_count = 1; ?>
<?php foreach ($devs as $dev): ?>
<div class="loaded-dev" id="dev<?php echo $post_count; ?>">
<?php echo get_the_post_thumbnail( $dev->ID, 'small' ); ?>
<a href="<?php echo get_permalink($dev); ?>" class="full-link"></a>
<h2><?php echo $dev->post_title; ?></h2>
<p><?php echo get_the_terms($dev->ID); ?> Developer</p>
</div>
<?php $post_count ++; ?>
<?php endforeach; ?>
</div>
<?php wp_reset_postdata(); ?>
Using get_cat_name as I am above returns 'Uncategorized', I believe because it's looking for the default Wordpress category and I am categorizing by custom taxonomy. How can I display my post's taxonomy name inside get_posts()
?