[Resolved] [wpv-post-body] does not render post content using template on WPViews 1.3.0.1

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 9 replies, has 3 voices.

Last updated by Ioannis 6 years, 5 months ago.

Assigned support staff: Adriano.

Author
Posts
#131545

The default behavior of rendering a post using it's set content template is broken in WP Views 1.3.0.1 and must use the view_template shortcode att to render the post properly.

After inspecting the code on wpv_shortcode_wpv_post_body you have introduced a $defaults = array('view_template' => 'None'); to default the view_template shortcode att with "None". In turn this sets the value of $post->view_template_override to none on all posts ignoring content templated saved in posts.

Thank you for looking into this.

#131713

Adriano
Supporter

Languages: English (English )

Timezone: America/Sao_Paulo (GMT-03:00)

Dear loannis,

Unfortunately I can't reproduce this issue here, it is working fine here. Could you reproduce the same issue in a Discover site? There we can using the latest version of all Toolset plugins and would be more simple to test.

#131960

Dear Andriano,

I have reproduced this issue in a clean wordpress 3.6 install and WP Views 1.3.0.1.

1. You neet to create new content template with the following content:

<div class="featured_image">
  [wpv-post-featured-image]
  [wpv-post-body]
  <div class="edit_link">
  [wpv-post-edit-link]
  </div>
</div>

2. Assign this template to a post and assign this post a featured image.

3. Create a new view of posts and on Layout HTML use :

[wpv-layout-start]
[wpv-items-found]
<!-- wpv-loop-start -->
<wpv-loop>
          [wpv-post-body]
</wpv-loop>
<!-- wpv-loop-end -->
[/wpv-items-found]
[wpv-no-items-found]
[wpml-string context="wpv-views"]<strong>No items found</strong>[/wpml-string]
[/wpv-no-items-found]
[wpv-layout-end]

4. use the newly created view in a page to display it

You should be presented with a view of posts that renders only the post bodies and the content template assigned to the post is ignored.

#132056

Adriano
Supporter

Languages: English (English )

Timezone: America/Sao_Paulo (GMT-03:00)

Dear Ioannis,

I've replicate here and it is working fine, the Content Template and the View are showing the post body properly. Please enable the debugging mode and let me know if you can see any error: https://toolset.com/documentation/user-guides/debugging-types-and-views/

#132100

Dear Andriano,

I have enabled debuggin mode on the test site but no error is shown in the console. This is incredibly frustrating...

Please log in to the test site I configured last night to verify the problem. It is a clean install with toolset only plugins and default wordpress theme.

test website: hidden link
username: toolset
password: toolset

Thank you for your assistance,

Ioannis

#132113

bruce
Supporter

Languages: English (English )

Timezone: Australia/Perth (GMT+08:00)

Hi Ioannis,

We did this change to stop an infinite loop from occurring in some situations in a Content Template.

I suggest you explicitly set the content template to use in the loop.

 
<wpv-loop>
          [wpv-post-body views_template="XYZ"]
</wpv-loop>

Best regards,
Bruce

#132122

Hi Bruce,

The problem with explicitly setting the views_template is that you can not have a loop that displays posts with different content templates (assigned on each post). May I ask what happens if we rename the content template... do we have to check all of our views to see if we hardcoded it somewhere?

Moreover, I just confirmed that assigning a content template to all posts (Views->Content Templates->Action->Change Usage) still renders the post ignoring the content template if you use the [wpv-post-body] shortcode without explicitly setting the views_template.

Lastly, and more importantly, such a change has a great impact on existing installations. For us, this only meant 2 client sites broken upon automatic update and 2 days of chasing though code to see what is going on.

I hope you can understand my frustration and revert this change.

Best Regards,
Ioannis

#132124

bruce
Supporter

Languages: English (English )

Timezone: Australia/Perth (GMT+08:00)

Hi Ioannis,

You might be right. I'll investigate this and see what we can do.

Sorry about the problems.

Best regards,
Bruce

#132297

bruce
Supporter

Languages: English (English )

Timezone: Australia/Perth (GMT+08:00)

Hi Ioannis,

I've reverted this change and added better detection of infinite loops. I'll send you an update to your email directly for you to test.

Best regards,
Bruce

#132465

Hi Bruce,

The issue is resolved with the views update you send me. Thank you for your swift resolution.

Best Regards,
Ioannis