I have the following page
hidden link
That is showing a list of publication types, which have a many 2 many relationship with another type called person.
The combo shows all the available people as selectable options through a "post relationship or repeatable field group owner" (see attached.
This filter is controlled through the following code
[wpv-control-post-relationship ancestors="person@publication-person.child" url_param="wpv-relationship-filter"]
[wpv-control-post-ancestor type="select" ancestor_type="person@publication-person.child"]
[/wpv-control-post-relationship]
What I would like to do is to limit the available option in the
[wpv-control-post-ancestor type="select" ancestor_type="person@publication-person.child"]
based on a property of the 'person' type.
Some 'people' are archived or not part of our team anymore, or may be external.
Is there any way to limit the options on that select box?
I am comfortable writing some code to replace that 'wpv-control-post-ancestor' shortcode.
Thanks
Shane
Supporter
Languages:
English (English )
Timezone:
America/Jamaica (GMT-05:00)
Hi Gregoris,
Thank you for getting in touch.
While i'm not aware of any way to do this using a PHP hook, we can hide the specific persons using Javascript if you know the persons who should be excluded from the list.
Add the following to the JS editor of your view.
jQuery(document).ready(function() {
jQuery('#wpv_control_select_wpv-relationship-filter').find("option:contains('Alexandros Bousdekis')").hide();
});
All that is needed is to add another line of
jQuery('#wpv_control_select_wpv-relationship-filter').find("option:contains('Alexandros Bousdekis')").hide();
Then change the name that is in the contains function. In my case I did it as an example with "Alexandros Bousdekis".
Please let me know if this helps.
Thanks,
Shane