Skip Navigation

[Resolved] View output shows current page in loop instead of post inside loop

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

This topic contains 1 reply, has 1 voice.

Last updated by takoL 4 years, 11 months ago.

Author
Posts
#1389779

I am trying to:
1. display custom fields of a post inside a view loop
2. display a cred edit form inside a view loop

I expected to see:
ad 1: the custom fields of the current post inside the loop
ad 2: a cred form editing the current post inside the loop

Instead, I got:
ad 1: custom fields of the current_page (i.e. [wpv-post-id] displays the title of the post where the view is shown, not the post inside the loop)
ad 2: the message: 'Form type and post type do not match' indicating that the post is trying to edit the current_page post instead of the post inside the loop

Additional info:
If we output the field of the post inside the view loop like this:
[wpv-post-title item="[wpv-post-id]"]
the title of the post in the loop is correctly displayed
If we output the field like this:
[wpv-post-title]
we get the title of the current_page, and not the post in the loop

Moreover:
If we output the cred form inside the view loop like this:
[cred_form form='task-archive']
we get a type mismatch (because the post where the view is inserted is from a different post type)
If we output the cred form inside the view loop like this:
[cred_form form='task-archive' post='wpv-post-id']
we do not get the type mismatch, but still the form is not working correctly because it tries to edit the current_page, not the post in the loop.
This is confirmed by the following:
If we output the cred form inside the view loop like this:
[cred_form form='task-archive' post='wpv-post-id']
and from within the form we output [wpv-post-id] , we see the post id of the current_page, not the post-id of the post inside the loop

This is kind of a big deal, because we make use of views extensively to display both post fields and post forms from inside a loop and this breaks a lot of the functionality of our sites.

#1389805

Never mind, we are looking into some code outside of Toolset plugins that is probably the cause of this bug...