最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

How can I output a post's custom taxonomies to a two column list?

programmeradmin1浏览0评论

I've just created a custom post type for speakers (motivational, financial, political, etc) and, when I post a new speaker, I have it set up that I can select their area(s) of speaking expertise (motivational, financial, political, etc). Well, what I'd like to do is display the chosen taxonomies on the speaker's profile page in an auto-generated two column layout. Say something like 5 or 6 items (taxonomies) per column.

I created the custom post types using Toolset and I'm using Beaver Builder and Beaver Themer to build out the front-end.

An example of the "Areas Of Expertise" (custom taxonomies) columns I'm looking to display can be seen at the link below under the "Add To List" and "Share" buttons.

Example page: [][1]

Anyone know how I can make this happen?

I've just created a custom post type for speakers (motivational, financial, political, etc) and, when I post a new speaker, I have it set up that I can select their area(s) of speaking expertise (motivational, financial, political, etc). Well, what I'd like to do is display the chosen taxonomies on the speaker's profile page in an auto-generated two column layout. Say something like 5 or 6 items (taxonomies) per column.

I created the custom post types using Toolset and I'm using Beaver Builder and Beaver Themer to build out the front-end.

An example of the "Areas Of Expertise" (custom taxonomies) columns I'm looking to display can be seen at the link below under the "Add To List" and "Share" buttons.

Example page: [https://nationalspeakers/mel-robbins][1]

Anyone know how I can make this happen?

Share Improve this question asked May 3, 2019 at 21:33 AlonsoF1AlonsoF1 437 bronze badges
Add a comment  | 

1 Answer 1

Reset to default 0

I'm not familiar with Beaver Builder or Beaver Themer, but this can be done easily using wp_get_post_terms(). It sounds like you are confusing "taxonomy" with "terms". The taxonomy is the "Areas of Expertise" that you created, the terms are each of the terms that you created in that taxonomy and assigned to any given post. On the single speaker page template you would query the terms for that taxonomy and then output the results in your desired markup like this:

$terms = wp_get_post_terms($post->ID, 'expertise_taxonomy');
echo '<ul>';
foreach($terms as $term){
    echo '<li>'.$term->name.'</li>';
}
echo '</ul>';

Adjust for whatever taxonomy slug, desired markup, classes etc. that you need/want. See WP_GET_POST_TERMS for reference.

发布评论

评论列表(0)

  1. 暂无评论