Tell us what you are trying to do?
I have a page where I show post depend on search param. I use custom template for it: [wpv-post-body view_template="blogpostmanagetemplate" item="[wpv-search-term param='postid']"]
Inside it I insert standard field wpf-body to show post text: [wpv-post-body view_template="None"].
But then I receive an error that I could not request post from the post (as it looks like recurrent request)
So, is there any way to show post body content within page depending on search param like "?postid=1"?
Hi,
Thank you for contacting us and I'd be happy to assist.
I tested the same setup on my test website and it worked without any errors.
You can show the content/body from the post available in the URL parameter, using the same 'item' attribute and it should work too:
[wpv-post-body view_template="None" item="[wpv-search-term param='postid']"]
If you're still seeing the error, please share a screenshot, so that it is more clear.
regards,
Waqar
Hi!
I use this:
[wpv-post-body view_template="blogpostmanagetemplate" item="[wpv-search-term param='postid']"]
and inside it I use this:
[wpv-post-body view_template="None" item="[wpv-search-term param='postid']"]
And then I have an error:
"Content not displayed because it produces an infinite loop.
The wpv-post-body shortcode was called more than once with the same attributes over the same context, triggering an infinite loop."
Thanks for writing back and for sharing the screenshot.
During further testing, I was able to see this warning message, only when no "postid" is provided in the URL parameter.
This makes sense, because when we provide another post/page ID in the "item" attribute of "wpv-post-body" shortcode, it gets the content/body from that post/page. But, if the "item" attribute is empty, then the same page's content/body is shown. And as the page's body contains the same shortcode, it results in looping over the same content, again and again.
To overcome, this you can wrap your parent/main level "wpv-post-body" shortcode in a conditional statement so that it is only shown when some "postid" is provided in the URL:
( ref: https://toolset.com/documentation/legacy-features/views-plugin/using-shortcodes-in-conditions/ )
[wpv-conditional if="( '[wpv-search-term param='postid']' gt '0' )"]
[wpv-post-body view_template="blogpostmanagetemplate" item="[wpv-search-term param='postid']"]
[/wpv-conditional]