Skip Navigation

[Resolved] Connect post type "Employee" Fields and post type "Specialisme"

This support ticket is created 6 years, 2 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 – 13:00 9:00 – 13:00 9:00 – 13:00 9:00 – 13:00 9:00 – 13:00 -
- 14:00 – 18:00 14:00 – 18:00 14:00 – 18:00 14:00 – 18:00 14:00 – 18:00 -

Supporter timezone: Asia/Hong_Kong (GMT+08:00)

This topic contains 8 replies, has 2 voices.

Last updated by Luo Yang 6 years, 2 months ago.

Assisted by: Luo Yang.

Author
Posts
#1137695
vakgebieden olenz.png
view look.jpg
Vakgebieden view.jpg
template for view.jpg
result.jpg
relattionship m2m.jpg
choosse werknemer (employee).jpg

I am trying to: Connect employees to specialist post based on fields, Christian Cox already suggest me how to do this but it is just not what i expected or i am doing something wrong. (think last option)

Link to a page where the issue can be seen: is local

I expected to see: Employees related to field choice in custom post

Instead, I got: empty (no results)

I am still not "happy" with how it work. I am able to get the employees connected to the post but it is a "manual" task where i think it can be much easier. And think it is not working how you explained me. Tried again the whole day but i just don't get the view working without manually add the employee(s) to each post. So for moment i added the employee "manually" to each post. But as there are 45 employees and hundreds of posts it will be a lot of work to use it in real live environment.

I am doing it now on my "real" project like this ;

- Werknemers, what means where are all employees with there own speciality.
- Vakgebieden, are the posts where i connect the werknemers (with there own speciality)

img; "Vakgebieden view", here you see that i can manually connect the employee to the post of vakgebieden.
img; "Choose werknemer (employee)" here i must find the employee.
img; "result", and it show the employee in the post.
img;"vakgebieden olenz" is the costume field from werknemer (employee) shown in the post vakgebieden.

Again it "works" but i am sure it is not using the "power" of toolset or am i wrong and means i have to add each employee to each post ?? and not choose speciality and all employees are shown from that specially in ones in the post ?

img;"relationship m2m is the m2m relation as suggested.
img;"view look" how i made the view
img;"template for view" how the view is made.

As you can see in image "choose werknemer" there is a option for "specialisme" but i always must choose a name with it and even when i don't choose on of the specialisme it still will show the werknemer (employee) in the post.

But i am sure i do something wrong here or i miss a important point in your explanation and there is a fantastic solution with 1click in the post (specialisme) and will show all specialist of that post.

Hope you can help me out here

cheers
Marcel

#1138081

Dear Marcel,

Yes, I think it is using "Toolset" power, new post type relationship many-to-many.

In order to setup the relationship between "Employees" and "speciality" posts, you will need to setup the relationship manually, or you can use CSV plugins to import the "Employees" and "speciality" posts, and setup the relationship in the CSV file, see our document:
https://toolset.com/documentation/user-guides/how-to-import-content-into-wordpress-using-csv/

The "WordPress Ultimate CSV Importer" plugin supports Toolset post type relationship:
https://toolset.com/documentation/user-guides/how-to-import-content-into-wordpress-using-csv/import-csv-ultimate-csv-importer-plugin/

For the problem:
and not choose speciality and all employees are shown from that specially in ones in the post ?
Please elaborate the problem with more details?
Where do you display the post view? In a single "speciality" post?
If it is, please follow our document to setup your post view:
https://toolset.com/documentation/post-relationships/how-to-display-related-posts-with-toolset/#displaying-many-related-items

It should be able to display related "Employees" posts only, not all "Employees" posts(including unrelated post)

And in your screenshot:
hidden link

You are using option "in any relationship", I suggest you switch to specific relationship name, in case there is other wrong setting in your website.

#1138094
employee post.png
post screen.png
show post.png

Hi Luo Yang,

Thanks for the response. Christian Cox opened my old ticket with this question and is answering, but still don't have it working and i think it is night time in his zone.

Well it works but not as expected. Probably i explain it to complex as i think it is something "easy"

Yes it is in a single (custom) post type. (see image)

What I understand now i must "connect" each employee manually what works as it shows the post with the "connected" employees. Where i expect to choose in post employee

To explain in one sentence what i like to see is. "Show related employees to a post "vakgebieden" based on field group field.

With option "Select posts with taxonomy" (see image) it works but i like to show it from the checkbox option "vakgebieden Olenz" instead of manually connect each employee.

I hope this make more sense 🙂 It is possible to use google hangout and explain it ?

Cheers
Marcel

ps are this images public ? In other words other can see this ?

#1138138
checkboxes-filter.JPG

Yes, the image is public, I don't think it needs google hangout,

I assume the custom field "vakgebieden Olenz" has been registered to bot post type: "Employees" and another "custom-post-type"

In a single "custom-post-type" post, you are going to display related "Employees" posts based on the value of field "vakgebieden Olenz".

If it is, it is possible, for example:
in a single "custom-post-type" post, you can get it's "vakgebieden Olenz" field value with Types shortcode:
[types field='vakgebieden-olenz' separator=', '][/types]

pass it as shortcode attribute of below view, for example:
1) Create a post view, query "Employees" posts, filter by:
Select items with field:
vakgebieden Olenz is a string in VIEW_PARAM(vo)

see screenshot checkboxes-filter.JPG

2) In the single "custom-post-type" post, display above view's shortcode like this:
[wpv-view name="connect-post-type" vo='[types field='vakgebieden-olenz' separator=', '][/types]']

And test again.

More help:
https://toolset.com/documentation/user-guides/passing-arguments-to-views/#accessing-the-arguments

#1138203
shortcode vakgebieden werknemers.png
Custom field filter vakgebieden olenz.png

Hi Luo,

yes i think this is what i need.

I followed your steps but i don't see any results (see images)

Custom field filter

Place the short code and only see " [/types]'] " as part of the short code in the post

#1138229

Sorry showed wrong short link this is the link I use [wpv-view name="employees" vo='[types field='vakgebieden-werknemer' separator=',']

See all employees and not filter by vakgebieden

Cheers

#1138807

It seems that you are using other page builder, that "shortcode" widget does not support shortcode insider shortcode feature, I suggest you try a pain text widget, or test it in post content directly.

Since your website is still under construct, in your case, I suggest you try with custom taxonomy instead of custom checkboxes field, custom taxonomy is built-in feature of wordpress, which is flexible and scalable.

For example:
1) Create a custom taxonomy "vakgebieden Olenz", register it to both post types:
- "Employees"
- your "custom-post-type"
https://toolset.com/documentation/user-guides/create-custom-taxonomies/

This should be able to setup another kind of many-to-many relationship between those two post types, you can add more terms in taxonomy "vakgebieden Olenz" when you edit a "Employees" or "custom-post-type" post.

2) In a single "custom-post-type" post, you can create a post view, query "Employees" posts, filter by:
Value set by the current page where this View is shown
https://toolset.com/documentation/user-guides/filtering-views-by-taxonomy/

It should be able display all "Employees" posts related to current "custom-post-type" post by the taxonomy "vakgebieden Olenz"

3) And you can setup the custom search form in your views on taxonomy "vakgebieden Olenz" easily:
https://toolset.com/documentation/user-guides/front-page-filters/

#1138901

Hi Luo,

Think that this is the way. (that was how it setup in the first place and then i thought it would be more useable for the user to make custom fields.)

Will test it further

Other quick question how can i show the taxonomy [types field='vakgebieden-werknemer' separator=', '][/types] was what i used to show the field, but need to show now the taxonomy.

Have great weekend

#1138912

If you are using the custom taxonomy "vakgebieden Olenz" as I mentioned above, in a single "custom-post-type" post or a single "Employees", you can display assigned terms using shortcode [wpv-post-taxonomy]
https://toolset.com/documentation/user-guides/views-shortcodes/#wpv-post-taxonomy
Output the taxonomy for the current post.

You can setup it within UI, see our document:
https://toolset.com/documentation/user-guides/view-templates/#2-add-fields-to-the-template

section "Add fields to the template"

See screenshot under text "2. Choose the field to insert"
hidden link