Skip Navigation

[Resolved] Problem with support

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
- 10:00 – 13:00 10:00 – 13:00 10:00 – 13:00 10:00 – 13:00 10: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/Kolkata (GMT+05:30)

This topic contains 2 replies, has 1 voice.

Last updated by Minesh 1 week, 3 days ago.

Assisted by: Minesh.

Author
Posts
#2818137

Hello,
I recently contacted support with a question about creating a pedigree for a dog breeding operation.
The solutions proposed by support are completely unrealistic. They involve duplicating CPTs almost infinitely using a method that is completely unergonomic.
Is there really no other method than the one proposed to create a pedigree without having to multiply the CPTs exponentially or without having to include them in each dog's file (where everything would have to be re-entered manually)? Many thanks if you can find a better solution.
Michel
NB: I tried to submit this via the ‘Need to tell us something about the quality of support’ link, but there seems to be a problem with the captcha.

#2818138

Hello,
I recently contacted support with a question about creating a pedigree for a dog breeding kennel.
The solutions proposed by support are completely unrealistic. They involve duplicating CPTs almost ad infinitum using a totally unsuitable method.
Is there really no other method than the one proposed to create a pedigree without exponentially multiplying the CPTs or including them in each dog's file (where everything would have to be re-entered manually)? Thank you very much if you can find a better solution.
Michel.
NB: I tried to submit this message via the ‘Need information about support quality’ link, but there seems to be a problem with the captcha.
The ticket in question is this one: https://toolset.com/forums/topic/genealogy/

#2818200

Minesh
Supporter

Languages: English (English )

Timezone: Asia/Kolkata (GMT+05:30)

Hello. Thank you for contacting the Toolset support.

I already shared the best option but if that does not suite your reuqirement.

Pleaes note that there is no self-join relationship possible using Toolset post-relationship. What I suggested is based on the requirement you had keeping in mind the post-relationship but if that is not your choice we can not do much.

However - I've another option but its not using post-relationship. You can add a select custom field to custom field group for father, mother, grandfather and grandmother. But please note that this is select field.

And you can auto-fill the options for this select field using the hook "wpt_field_options" hook.

For example:

add_filter( 'wpt_field_options', 'func_to_dynamically_populate_father_mother', 10, 3);
function func_to_dynamically_populate_father_mother( $options, $title, $type ){
    switch( $title ){
        case 'Dog Father':
        case 'Dog Mother':
            $options = array();
   
            // add first empty value
            $options[] = array('#value' => '', '#title' => $title );
   
            // get all tmna-location post items
            $args = array( 'post_type' => 'dog', 'posts_per_page' => -1, 'post_status' => 'publish','orderby' => 'title' );
   
            $results = get_posts( $args );
            if ( $results ) {
                foreach ( $results as $post ) {
                    $options[] = array('#value' => $post->ID, '#title' => $post->post_title);
                }
            }
   
        break;
    }
    return $options;
}

Where:
- Repalce the "Dog Father" and "Dog Mother" with your original custom field title for dog father and mother. Please change the "post_type" slug to actual one of you Dogs post type.

More info:
- https://toolset.com/documentation/programmer-reference/types-api-filters/#wpt_field_options

Doing this it will auto-populate the options with existing Dog and you can set the father/mother/grandfather/grandmother as requried.

Please check the following related tickets that may help:
- https://toolset.com/forums/topic/ordering-a-select-list-in-alphabetical-order-on-the-post-type-edit-screen/
- https://toolset.com/forums/topic/custom-select-field-with-dynamic-data-2/