Skip Navigation

[Resolved] Setting Child Post name same as parent from cred link

This support ticket is created 7 years, 7 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
- 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 5 replies, has 2 voices.

Last updated by terryP-2 7 years, 7 months ago.

Assisted by: Minesh.

Author
Posts
#429268

<h3>[cred_post_parent get='title']</h3> => Displays parent post title
[cred-field field="post_title" post="send-card" value="[get-title]"] => Displays title of page used to create post via cred child post link. (link to video demonstrating issue follows description)

I wish to automatically name the child posts same as parent post. Since each CPT will have its post type as a name in the url. Ie... a Reviews CPT has a url of review us this is a child of a parent post whos title will be a company name etc.. so url would look like this from a CPT child hidden link...review-us/Company-Name. So if each Child post uses same Title name it will work since each post type will prepend url path.

So I followed this forum topic as well as a few others with same result. regardless of what variables i place into function or cred form it still displays the page title used to create the child post via a cred child post link.

https://toolset.com/forums/topic/cred-form-to-set-new-cpt-title-to-same-as-referring-parent-title/

I have placed this code into my functions.php and registered it in settings shortcodes.

add_shortcode("get-title", "get_title");
function get_title($atts) {
$post_id = $_REQUEST["parent_post_id"];

return get_the_title($post_id);
}
This is video link demonstrating issue
hidden link

#429387

Minesh
Supporter

Languages: English (English )

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

Hello. Thank you for contacting the Toolset support.

As I understand you would like to prepopulate the title field value that is equal to your parent post field value.

I would like to check on your setup how you setup your child form etc..etc... Could you please share your problem URL and temporary access details.

*** 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 would additionally need your permission to de- and re-activate Plugins and the Theme, and to change configurations on the site. This is also a reason the backup is really important. If you agree to this, please use the form fields I have enabled below to provide temporary access details (wp-admin and FTP).

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

#430626

Minesh
Supporter

Languages: English (English )

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

Could you please share URL of the page where you added CRED child form link as shown in video you shared with us.

#430763

Did not mention this. The view send rating card is only page that has a edit link currently, you will see when creating a post it pulls in the parent post title displayed, but when editing it shows "previous page" instead of parent post title, the code in cred form is same as that in the create and edit.

#430769

Minesh
Supporter

Languages: English (English )

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

Thanks for the information.

I've fixed your issue successfully. The issue was URL param name you were using with was wrong.

I've changed your functions.php file code as given under:

add_shortcode("get-title", "get_title");
function get_title($atts) {
    $post_id = $_REQUEST["parent_rate-and-review_id"];
 
    return get_the_title($post_id);
}

I can see now that parent title is displayed as value of child post title textbox. Could you please confirm and mark resolve this ticket.

Have a great day!!

#430988

Thanks one again for the solid support. Often we focus in on something and overlook the obvious this was the only variable I did not try.

This ticket is now closed. If you're a WPML client and need related help, please open a new support ticket.