Skip Navigation

[Resolved] Getting an error when trying to display one page's content within another

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

Last updated by matthewC-9 4 years, 9 months ago.

Assisted by: Christian Cox.

Author
Posts
#1516635

I'm trying to display the content of one page (id 1705) within another (id 1866).

I used the "fields and views" button to put this in the body of 1866: [wpv-post-body view_template="None" item="1705"]

When I view the page, I see this error message: Content not displayed because it produces an infinite loop.
The wpv-post-body shortcode was called more than once with the attribute view_template="None" over the post "Meeting Room Policy", triggering an infinite loop.

What do I need to do differently?

#1516829

Hi, usually this indicates that the post body for post 1705 contains a wpv-post-body shortcode to display its own contents, or the Content Template assigned to post 1866 contains a wpv-post-body shortcode with no specified item. Either would trigger an infinite loop in this case. Can you check both of those possibilities and let me know what you find out?

#1516833

Hi Christian, thanks for the reply. The content template assigned to both pages does indeed have this shortcode in it: [wpv-post-body view_template="None"]. I do always want the page template to pull in the content of the current page, which is what that's intended to do, but in this particular case, I also want to embed the body content of another page within it. Is there a better way to do that?

#1518855

There's not really a good way to do that with the post body when a Content Template that contains view_template="None" is applied to both posts. You could add a WYSIWYG custom field to the post and display the field in your content template(s) instead. That's probably the most straight forward way without utilizing custom code. Let me know if you have questions about that.

#1525701

I don't want to add a new field just for this one instance, so I'm just going to copy / paste the content from the one page into the other. Wish there was a way to specify in the template that the post body should be pulled from the current post so this issue could be avoided, but this will work for now. Thanks for your help!