Skip Navigation

[Resolved] How to show great grandfather post WYSIWYG in the right format on a child post

This support ticket is created 2 years, 10 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.

Our next available supporter will start replying to tickets in about 2.17 hours from now. Thank you for your understanding.

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 himanshuS 2 years, 10 months ago.

Assisted by: Minesh.

Author
Posts
#2086813

I have a great-grandchild post - an "expert match" that needs to show the "project prompt" post (great grand father post) description. I can get the data from user_meta but I am not sure how to maintain the format of the WYSIWYG field. The types shortcode doesn't have an option for a post ID so I can't use that to retrieve the data in the right format.

my current code

 
<?php global $post;
$problem_statement_description = null;
$expert_match_id = $post->ID;
if( $expert_match_id != null){
$expert_review_request_id = toolset_get_related_post($expert_match_id, 'expert-review-request-to-expert-match', 'parent', array('post_status' => 'publish'));
	if($expert_review_request_id != null) {
	$project_submission_id = toolset_get_related_post($expert_review_request_id, 'project-submission-to-expert-review-request', 'parent', array('post_status' => 'publish'));	
	if( $project_submission_id != null) {
	$project_prompt_id = toolset_get_related_post($project_submission_id, 'project-prompt-to-project-submission', 'parent', array('post_status' => 'publish'));
	$problem_statement_description = get_post_meta($project_prompt_id, 'wpcf-prompt-description', true);
	}
	}
}

echo $problem_statement_description;

?>
#2088031

Minesh
Supporter

Languages: English (English )

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

Hello. Thank you for contacting the Toolset support.

The code you shared to fetch the great grand parent looks ok to me but I do not understand what you mean by ". The types shortcode doesn't have an option for a post ID so I can't use that to retrieve the data in the right format."?
OR
Where exactly you are facing the issue?

#2088067

The text shows inline and linebreaks are lost.

For example,
<b>This text</b>
Context
context goes here

Objective
Objective goes here

Format
just a presentation Resources (if any) Not right now.

<b>changes to </b>
Context context goes here Objective Objective goes here Format just a presentation Resources (if any) Not right now.

#2088073

Minesh
Supporter

Languages: English (English )

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

What if you try to use the Types PHP API function types_render_field() instead of get_post_meta():

For Example:

echo types_render_field( 'prompt-description', array( 'item' => $project_prompt_id ) );
#2088581

My issue is resolved now. Thank you!

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