Skip Navigation

[Resolved] How to display custom taxonomy value of user in a loop (user has a mirrored CPT)

This support ticket is created 2 years, 7 months ago. There's a good chance that you are reading advice that it now obsolete.

This is the technical support forum for Toolset - a suite of plugins for developing WordPress sites without writing PHP.

Everyone can read this forum, but only Toolset clients can post in it. Toolset support works 6 days per week, 19 hours per day.

Sun Mon Tue Wed Thu Fri Sat
- 9:00 – 12:00 9:00 – 12:00 9:00 – 12:00 9:00 – 12:00 9:00 – 12:00 -
- 13:00 – 18:00 13:00 – 18:00 13:00 – 18:00 14:00 – 18:00 13:00 – 18:00 -

Supporter timezone: America/Jamaica (GMT-05:00)

This topic contains 1 reply, has 2 voices.

Last updated by Shane 2 years, 7 months ago.

Assisted by: Shane.

Author
Posts
#2334475
toolset-how-to-load-custom-taxonomy-into-view-loop-template.png

Tell us what you are trying to do?
Hi guys, so I will explain:
- I have a custom User Role of 'Customer'

- Due to the restraints of 'Users' in WordPress and my need to apply multiple custom fields and relationships to users, I also have a custom post type of 'Customer'. When I setup a user which is a 'Customer', I have some custom code which then applies the email address to my 'Customer' Custom Post Type (the email being the Title field of my Customer), which then allows me to populate the Customer CPT with other custom fields, within the Customer Custom Post Type. (Hope this makes sense so far!)

- I also have another custom User Role of 'Staff', these are basically people who work for my clients company who will be able to log into WordPress and to add / edit / remove Customer users.

- I wanted for 'Customer' users to have a 'Company' field (so Customer A works for Company B for example), but due to me potentially having lots of users which could be part of the same Company, rather than set up 'Company' as a custom field, I set it up as a 'Custom Taxonomy', as I thought this would be more beneficial for development of the project going forward. That way I can easily link all 'Customers' who are part of the same 'Company', as this is a function which my client wanted for their website.

However, now this is where my problem has arisen:

- I am trying to build a Toolset 'View', accessible by 'Staff' users, which lists all 'Customers' users (so I am using a loop), along with various custom information which has been attributed to them (so as an example - each row of my view will show their Name, Age, Company, this is purely for example purposes and not exactly as in my View). Now, I am easily able to add custom fields to my view (in the example given Name and Age are custom fields), but their is no way for me to add the 'Company' to the view, as it is a Taxonomy and Taxonomies do not show up as an option in my View Builder. I have attached a screenshot where I explain this further.

Please can you tell me how I can load the Company Taxonomy for each user in my loop, for my View?

Thanks very much for your help,

Keith

Is there any documentation that you are following? There isn't any documentation I can find to tell me how to do this

Is there a similar example that we can see? No

What is the link to your site? It's under development, but I can provide URL's, Administrator logins etc if required, please just let me know if you need it 🙂

#2334629

Shane
Supporter

Languages: English (English )

Timezone: America/Jamaica (GMT-05:00)

Hi Keith,

Thank you for getting in touch.

If it's simply the taxonomy for the user's profile you wish to add then the shortcode below should suffice.
https://toolset.com/documentation/programmer-reference/views/views-shortcodes/#vf-153472

Please let me know if this shortcode helps.
Thanks,
Shane