Skip Navigation

[Resolved] Display parent title field in child view issue

This support ticket is created 7 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.

No supporters are available to work today on Toolset forum. Feel free to create tickets and we will handle it as soon as we are online. Thank you for your understanding.

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 5 replies, has 2 voices.

Last updated by Shane 7 years, 2 months ago.

Assisted by: Shane.

Author
Posts
#567639

I have two custom post types set up in Types: Projects and Proposals. Proposals is a child of Projects. I have created a CRED form for proposals and placed it in the Project content template. I am using custom code to automatically populate the Parent field, so I have hidden this field from the CRED form. See custom code below:

function my_save_data_action_1($post_id, $form_data) {
    // If a specific form
    if ($form_data['id']==550 {
        //Get the ID of the Post where the CRED is in (parent post id)
        $parent_post_id = $form_data["container_id"];
        //get the post type of the post where the CRED is in (parent post type)
        $type = $form_data['post_type'];
        //redefine the meta_key for the parent post id in the current edited/created Child Post 
        $our_new_wpcf_belongs_parent_id = "_wpcf_belongs_".$type."_id";
        //update this field with all data
        update_post_meta($post_id, $our_new_wpcf_belongs_parent_id, $parent_post_id);
    }
}
add_action('cred_save_data', 'my_save_data_action_1',10,2);

When I view the Proposal in WordPress, the parent field is correct and has been updated using the custom code.

Here’s the problem: I have created a view that will display a list of all proposals for a project. I am trying to insert the title of the parent project within this view, and I am also trying to link each item in the loop to the parent project.

Here is what I am using:

[wpv-post-title id="$legal-scout-project"]

Initially, this does not work. It just displays the title of the proposal, instead of the title of the project.

If I view the proposal in WordPress, make no changes, and then click update. The post title in the Proposals View then shows the correct title, which is the title of the Parent Project.

Manually updating the proposal in WordPress each time a proposal is submitted is not an option.

Any ideas on how this could be fixed? Thanks in advance!

#567716

Shane
Supporter

Languages: English (English )

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

Hi Zach,

Thank you for contacting our support forum.

Was the relationships created through types ? Meaning if I go to one of the Post I would see the associated Parent with it ? Or is it that you just have this hidden field on the posts.

Please let me know.

Thanks,
Shane

#567718

Hi Shane,

Yes, this relationship was created with types. I auto-generated the form, and I am using css to hide the field where you select the parent item, since it automatically populates using custom code. If I view a proposal, there is a field for the parent project.

#567987

Shane
Supporter

Languages: English (English )

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

Hi Zach,

I see so essentially it should work then.

Would you mind providing me with admin access to the website so that I can have a look around and ensure that everything is functioning correctly.

Thanks,
Shane

#567988

Shane
Supporter

Languages: English (English )

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

Private Fields

#569166

Shane
Supporter

Languages: English (English )

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

Hi Zach,

Thanks for the credentials.

I see no reason why this shouldn't work, however I would recommend updating your toolset plugins as they are outdated.

Next there could be a plugin conflict somewhere that could be causing this to occur.

What I recommend that you do is to temporarily disable all your non-toolset plugins and try again.

Thanks,
Shane