Skip Navigation

[Resolved] Using Custom Fields To Create A Category Then Assigning Post's To That Category

This support ticket is created 5 years, 10 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
8:00 – 12:00 8:00 – 12:00 8:00 – 12:00 8:00 – 12:00 8:00 – 12:00 - -
13:00 – 17:00 13:00 – 17:00 13:00 – 17:00 13:00 – 17:00 13:00 – 17:00 - -

Supporter timezone: America/New_York (GMT-04:00)

This topic contains 1 reply, has 2 voices.

Last updated by Christian Cox 5 years, 10 months ago.

Assisted by: Christian Cox.

Author
Posts
#1181600
Expert partner profile wireframe.png
expert partner profile demo.png

Tell us what you are trying to do?

Please see the wireframe of what we want to achieve and then see what we have created so far.

I'm trying to set it up so that when I create a profile for one of our expert partners, we can create a category for them individually whilst we are filling in all their other details such as name, email, social profiles as I have currently setup.

Then when we add new content (currently just blogs but will be other post types), we can assign that content to the category and have that show up on their individual profile page.

As we are currently adding and created the profiles for our partners, we want to be able to have new articles for that partner profile to show up when we tag it with their category.

Is there any documentation that you are following?

I've been looking at the directory site info as well as other forum and support threads.

Is there a similar example that we can see?

Yes on the real estate demo site > only difference is, we want the recommended articles to update automatically when we assign that category to new content > Essentially a mini blog feed based on a category.

What is the link to your site?

The site is on a staging subdirectory of the main site at present and has http auth in place, so you won't be able to see it without a password. Happy to provide a login though.

#1181649
Screen Shot 2019-01-10 at 12.41.02 PM.png

Hi, one way to accomplish this is to use the slug of the Profile post as a taxonomy term slug. For example, if the Profile post slug is "john-smith", then you will create a taxonomy term with the same slug "john-smith". That slug can be in a custom taxonomy created with Types, or in the standard WordPress taxonomy Category or Tag. A custom taxonomy might be easier to keep organized. Then, assign that john-smith term to post or custom post you want to associate with John Smith.

Next, create a View of those posts filtered by taxonomy term, where the term slug is set by a shortcode attribute. I'm attaching a screenshot here as an example. In the loop, display information about the post, like a post link, or a post featured image, using shortcodes. Insert this View in the template for Profile posts, and add the shortcode attribute you defined in the Query Filter (mine was authortax). Insert the current post slug in the shortcode attribute to pass that value into the term filter, like this:

[wpv-view name="Your View Name" authortax="[wpv-post-slug id='$current_page']"]

Now your View is filtered by the taxonomy term with a slug that matches the slug of the current post. It will be dynamic depending on which Profile post you're visiting on the front-end, so the taxonomy term filter will respond to the current Profile. This technique is called passing arguments into Views. We have more information about passing arguments into Views here:
https://toolset.com/documentation/user-guides/passing-arguments-to-views/
We have more information about the post slug shortcode here:
https://toolset.com/documentation/user-guides/views-shortcodes/

Let me know if you get stuck, and I can take a closer look.