Skip Navigation

[Résolu] Displaying Fields of Parent Pages in a CRED Form

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.

This topic contains 8 réponses, has 3 voix.

Last updated by Joff Il y a 7 années et 7 mois.


I have a parent-child relation fpr posts: parent is a "workshop", child is a "application/attendee" for a workshop. I'm using a cred form for the application of a workshop according to this user guide:

As far as I see I can only disply tile and URL of the parent page in the form, correct?
But I would like to display more custom fields that I have defined for the parent post, e.g. the date and the price of the workshop. I'd like to display this information both on the form page and in the confirmation email that is sent to the user.
How to achieve that?


Agnes Bury

Languages: Anglais (English )

Timezone: Pacific/Midway (GMT-11:00)

Dear thomasD-2,
you can always reference to all parent fields from a child view/CRED form adding parent id attribute like in the following example:

Parent: Company
Child: Employee

<span>Employee's company name: [types field="company-name" id="$company"][/types]</span>

where company is parent's slug you defined in Types setting when defining your custom post type


Hello Agnes,
thx for the quick response. However the solution doesn't work on my server. Nothing is displayed when I insert the following code in my CRED form:
<span>[types field="preis" id="$veranstaltung"][/types]</span>
What's wrong with this?
The slug of the parent post type is "veranstaltung", the name of the custom field is "preis".
The CRED form is integrated via shortcode on a separate page, and the page is opened via a child link - the URL of the page looks like this: /wordpress/../newpage/?parent_veranstaltung_id=288.

One the page the parent title is shown via this shortcode:
<h2>Workshop[cred-post-parent get='title']</h2>
But I can not manage to display the parent field "preis"


Agnes Bury

Languages: Anglais (English )

Timezone: Pacific/Midway (GMT-11:00)

Dear thomasD-2,
first thing first, make sure you use your CRED form in the relevant place.

Is the CRED form displayed on the page you mentioned? Can you see all the input form fields you defined creating your CRED form? If you cannot see none of them this means that you inserted your CRED form not in the right place.

For example if you have an Edit Form for a child post you cann't display the form anywhere. The form must be applied to a specific post. The post which is going to be edited via the form. So the best place to insert Edit Form is a Template Content for single custom post.

You can as well insert the CRED form in other places, like a page but the CRED must be in a way related to a single custom post you which is going to be edited via the form. You can insert the CRED form with a specific post id in this case. See:


Hi Agnes,
yes, I can see my form, and it is fully functional. It shows a select dropdown with the available items (veranstaltungen), and the chosen "Veranstaltung" (submitted to the form via URL-parameter "?parent_veranstaltung_id=288") is already pre-selected. The user can fill the form and sumbit the data etc. All this works fine. The only thing is that I can't display any fields from the parent post other than the title and the URL.

There are these two shortcodes I can use for title and URL: [cred-post-parent get='title'] [cred-post-parent get='url'] What I would need is a shortcode also for the other fields. My setup is pretty similar to the book review example explained here: In this document it is recommended that the new-content form is placed on a page.

I've played around with the solution that you suggested, the shortcode [types field="company-name" id="$company"]. This works fine for displaying of _existing_ posts and the respective parent content. But it doesn't work for newly created content. This seems to be kind of a shortcoming in the functionality of CRED, as CRED knows from the URL-parameter about the parent page of the content that is going to be created with the empty form. Maybe you can take that into account for further updates of CRED.

Do you think that there is a solution for my requirement?


Agnes Bury

Languages: Anglais (English )

Timezone: Pacific/Midway (GMT-11:00)

Dear thomasD-2
you are right. The code I showed above will only work when used in an Edit form. This is because the post id is already known.

You can however show the full parent's info when creating a new child post as well, using CRED. I will show you how but first I must prepare some screenshots to explain it step by step. I will keep you posting.


Agnes Bury

Languages: Anglais (English )

Timezone: Pacific/Midway (GMT-11:00)


The idea:
1. You create a View showing full parent info based on a specific id received in URL (see picture 1, this is a simple View having Company post type selected in 'Content Selection' section and all Companies fields in the loop, see picture 2)
2. You insert this View in your CRED form for creating a new child (see picture 3)
3. The add new child CRED form must be called with the parent's id being passed into (see picture 4)

When you click Add Employee button your URL will look like this:
hidden link

look at the end, there is ?parent_company_id=333
so now, the CRED form knows his parent's id and the View used in that form receives the id as a parameter. Now is ready to show full parent info (see picture 5)

Please let me know if you are satisfied with my answer and if I can help you with any other questions you might have.


This solution works perfectly. Thx very much for your detailed and very helpful support.


A shorter way might be what I have just sorted out.

I was just wanting to pull the parent title into my form. I have the form shortcode within the page.

I slightly modified Louy's code at to suit my needs

//Shortcode to get current page as parent (for CRED form relationships)
add_shortcode('current-parent-title', 'current_parent_id_func');
function current_parent_id_func($atts, $content){
    $queried_object = get_queried_object();
    $title = get_the_title($queried_object);
    return $title;

Now the [current-parent-title] shortcode provides the parent title. As get_queried_object returns the current post, this could be modified to extract any post data really.