Skip Navigation

[Resolved] Cannot display field from repeating field group parent in CRED form for child

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

Last updated by Minesh 6 months, 1 week ago.

Assisted by: Minesh.

Author
Posts
#2702455

I have a CPT "Package" which has a RFG "Section". If I try to display the package (parent) body (or title)in a CRED form for creating a section it does not display.

The UI creates the following reference in the form [wpv-post-body view_template="None" item="@section.parent"]

What am I doing wrong?

#2702482

Minesh
Supporter

Languages: English (English )

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

Hello. Thank you for contacting the Toolset support.

As I understand you want to add post body content to post title of your child post? If this is correct why as post body content may consists of block.

Do you want to make dynamic title using custom fields value? If yes:
- You can use the Toolset Form's hook "cred_save_data":

For example:

//Create a dynamic post title by the CRED form.
add_action('cred_save_data','func_custom_post_title',10,2);
function func_custom_post_title($post_id,$form_data) {

   if($form_data['id']==9999) {
           
           $name = get_post_meta($post_id, 'wpcf-name', true);
           $email = get_post_meta($post_id, 'wpcf-email', true);
           $title= $name. '-' . $email;
           
           $args = array('ID' => $post_id, 'post_title' => $title);
           wp_update_post($args);
    }
}

Where:
- You can replace the 9999 with your original form ID
- You can adjust the above code as required.

More info:
- https://toolset.com/documentation/programmer-reference/cred-api/#cred_save_data

#2702503

Sorry, no. I am trying to do something much simpler.

I just want to show the post title and body text of the package at the top of the form which creates a section for the package.

#2702771

Minesh
Supporter

Languages: English (English )

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

Can you please share problem URL and send me details what thing you want to display and at what section and using what shortcode.

*** Please make a FULL BACKUP of your database and website.***
I would also eventually need to request temporary access (WP-Admin and FTP) to your site. Preferably to a test site where the problem has been replicated if possible in order to be of better help and check if some configurations might need to be changed.

I have set the next reply to private which means only you and I have access to it.

#2703028

Minesh
Supporter

Languages: English (English )

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

Can you please check now: hidden link

With your form I've adjusted the shortcode as given under where I've used the shortcode [wpv-search-term param='id'] to get the parent ID from URL param id.
- hidden link

<div class="row">
    -[wpv-post-link item="[wpv-search-term param='id']"]-
  </div>
  <div class="row">
   - [wpv-post-body view_template="None" item="[wpv-search-term param='id']"]-
  </div>

Can you please confirm it works as expected now.

More info:
- https://toolset.com/documentation/programmer-reference/views/views-shortcodes/#wpv-search-term

#2703164

Thanks. Sorry I didn't realise that the search term would be needed but thinking about it, I see that the form would have no context as to the parent post id.