Display custom taxonomy terms for CPT-onomy on a single post page
-
First of all, thank you so much for your wonderful plugin and for the amazing support you provide!
I have a CPT-onomy called “People” that I’m using on my posts.
I have created a custom taxonomy for People called “Institutions”
I have created a custom field for People called “URL”
On the sidebar for each individual post (in single.php), I need to display an alphabetical list of all “People” related to the post and include the following information for each Person:
- Person’s featured image
- Person’s title hyperlinked with person’s “URL”
- Person’s “Institution”
I’ve been hacking away at this for about two days now, and so far I’ve only come up with:
<?php $people_list = get_the_terms( $post->ID, 'people' ); if ( $people_list && ! is_wp_error( $people_list ) ) : ?><?php foreach ( $people_list as $term ) { ?><p><?php if ( has_post_thumbnail( $term->term_id ) && ( $image = wp_get_attachment_image_src( get_post_thumbnail_id( $term->term_id ), 'full' ) ) && isset( $image[0] ) ) { ?><img src="<?php echo $image[0]; ?>" class="alignleft" /><a href="#"><?php } echo $term->name; ?></a></p> <?php } ?> <?php endif; ?>
This is of course based on your extremely helpful example from the documentation on your site. This code takes care of the featured image and the title, but I’m stuck now on how to add the link to the URL and the institutions. Can you give me some hints on how to accomplish this?
Unfortunately I’m not able to make my site public yet, so I can’t provide a link for reference.
Thank you very much for all you do to make this amazing plugin!
- The topic ‘Display custom taxonomy terms for CPT-onomy on a single post page’ is closed to new replies.