Skip Navigation

[Resolved] Losing Post Content when use Edit button in course single Learndash-buddyboss

This thread is resolved. Here is a description of the problem and solution.

Problem: When I display a post with my Content Template applied, the post contents are not displayed. The page appears empty except for the main site header and footer and an "edit post link" I added to the Content Template.

Solution: Anything you want to display in the main post area should be added to the Content Template, since the post contents and other fields are not automatically displayed here. You can use a Single Field block to display the post contents with the dynamic sources feature.

Relevant Documentation:
https://toolset.com/course-lesson/creating-templates-to-display-custom-posts/

This support ticket is created 4 years, 6 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
8:00 – 12:00 8:00 – 12:00 8:00 – 12:00 8:00 – 12:00 8:00 – 12:00 - -
13:00 – 17:00 13:00 – 17:00 13:00 – 17:00 13:00 – 17:00 13:00 – 17:00 - -

Supporter timezone: America/New_York (GMT-04:00)

This topic contains 7 replies, has 3 voices.

Last updated by Christian Cox 4 years, 6 months ago.

Assisted by: Christian Cox.

Author
Posts
#1995705

Tell us what you are trying to do?
I like to have the frontend edit button in the courses, lessons and topics template in Learndash in the Buddyboss theme template.

Is there any documentation that you are following?
Yes, I followed the Front-end Forms for Editing Content Course - everything works until showing up the Course Page. The edit-button is there, the course content text is lost
Is there a similar example that we can see?
I made a video to describe the problem hidden link
What is the link to your site?
Original hidden link but the test I've made is on hidden link

If you need admin credentials or ftp please ask.
Thanks,
Wolfgang

#1995943

Nigel
Supporter

Languages: English (English ) Spanish (Español )

Timezone: Europe/London (GMT+01:00)

Hi there

I think it would be helpful to have credentials for the staging site to be able to look more closely at your set up, so let me mark your next reply as private so that we can get log-in credentials from you—you may want to create a temporary admin user for us to use that you can later delete.

Can you also confirm the url of where the problem is visible.

#1996513

Sorry, I forgot the url 😉 hidden link
hidden link there you find all courses

#1996525

Hi, it seems like the main issue here is the main Content Template (ID 619) is empty. The post content has not been inserted in the template. The Content Template only includes the "Edit Post Link" you added, not any other content like the post body. The original contents from your PHP template are not added to the Content Template automatically. Anything you want to display in the Content Template must be inserted using blocks in the block editor. If you want to display the post content in the Content Template, you could add a Single Field block in the Content Template and use the dynamic sources feature to display the post contents. The contents from the Content Template will be displayed in place of the_content() in your single course PHP template file.

I hope this helps clarify things. Let me know if I've misunderstood the problem.

#1996569
Bildschirmfoto 2021-03-22 um 19.08.00.png

Hi Christian,
thanks a lot. I thought thats the reason. So I've tried it with the Standard field source - Current Course - Post Content (body) but the result you see here hidden link

In the Template the content is displayed correct - only the text. That's why I stopped it and asked.

I haven't tried it but body means also display all block an author has created if I give him the permission to use Gutenberg for Course creation?
Thanks,
Wolfgang

#1996681
Screen Shot 2021-03-22 at 3.40.46 PM.png

In the Template the content is displayed correct - only the text. That's why I stopped it and asked.
It is unusual to see the main site's header and footer repeated like this when a Content Template is used. What happens if you activate the parent theme instead of the child theme - is the header repeated? I suspect something unusual in your child theme's PHP template is responsible for this replication, but I could be wrong. I am attaching a screenshot here showing single-book.php, a basic single post PHP template file for a custom post type "Book". You can see that the template calls get_header() to render the main site header, and calls get_footer() to render the main site footer. It also sets up a standard loop using while( have_posts() ), then calls the_post() and the_content() inside that while loop. That's basically all you need in the template. Everything normally displayed by the_content() will be replaced with the Content Template I have applied to the Book custom post type.

My supsicion is that your PHP template handles things a bit differently, and that's why there are repeated elements like the header and footer. Can you zip up your single Course PHP template and post it to Dropbox or Drive? Include a download link in your next reply. All URLs you share in the forum are hidden from public view for your security. I will take a look and see if there are any obvious problems in the template.

I haven't tried it but body means also display all block an author has created if I give him the permission to use Gutenberg for Course creation?
In a standard custom post, any blocks inside the main post editor will be output by the Single Field block in the Content Template when you use Dynamic Sources to display the Post Content (Body). I'm not completely sure how that applies to custom posts created by the LearnDash system (like Courses) and the permissions associated with those posts, but I suspect that it works similarly.

#1997125
Bildschirmfoto 2021-03-23 um 08.16.22.png
Bildschirmfoto 2021-03-23 um 08.16.45.png

Hi Christian,
thanks a lot for your time and your feedback. Sometimes a night of good sleep helps 🙂
I found a simple but very effective solution. I've took the shortcode and placed it in a text-widget in the sidebar. And voila, it works perfect. See pictures.
Thanks a lot. Should I resolve the threat?
Yours,
Wolfgang

#1997799

Ok great, thanks for the update. I will resolve the thread here for you. Feel free to open new tickets as needed.