Skip Navigation

[Resolved] Stray [/wpv-conditional] on some but not all displays

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 2 voices.

Last updated by Luo Yang 1 year, 3 months ago.

Assigned support staff: Luo Yang.

Author
Posts
#1254633

I have the following view. It works fine and does what it need to do, however sometimes a stray [/wpv-conditional] shows.

Looking at the markup and doing some tests, I can see it coming from the closing conditional below:

[wpv-conditional if="( '[lowercase string='[wpv-current-user info='login']']' eq '[lowercase string='[wpv-post-title output='raw']']' )" ] 

Here is the full view. Any thoughts on why this is occurring?

[wpv-layout-start]
	[wpv-items-found]
	<!-- wpv-loop-start -->

		<wpv-loop>           
[wpv-conditional if="( '[lowercase string='[wpv-current-user info='login']']' eq '[lowercase string='[wpv-post-title output='raw']']' )" ] 
          [wpv-conditional if="( '[types field='course-level' output='raw'][/types]' eq '3' )"]<h3>Course: Anatomy for TT Level 200 (20 hours)</h3>
          <strong>Instructor: [wpv-user field="user_firstname"] [wpv-user field="user_lastname"]</strong><br /> Following is a list of your enrolled students with the course name and progress:<br /><br />  
          [wpv-view name="instruct-student-get-student-progress" users="[types field='student-1' output='raw'][/types]"]
          [wpv-view name="instruct-student-get-student-progress" users="[types field='student-2' output='raw'][/types]"]
          [wpv-view name="instruct-student-get-student-progress" users="[types field='student-3' output='raw'][/types]"]
          [wpv-view name="instruct-student-get-student-progress" users="[types field='student-4' output='raw'][/types]"]
          [wpv-view name="instruct-student-get-student-progress" users="[types field='student-5' output='raw'][/types]"]
          [wpv-view name="instruct-student-get-student-progress" users="[types field='student-6' output='raw'][/types]"]
          [wpv-view name="instruct-student-get-student-progress" users="[types field='student-7' output='raw'][/types]"]
          [wpv-view name="instruct-student-get-student-progress" users="[types field='student-8' output='raw'][/types]"]
          [wpv-view name="instruct-student-get-student-progress" users="[types field='student-9' output='raw'][/types]"]
          [wpv-view name="instruct-student-get-student-progress" users="[types field='student-10' output='raw'][/types]"]
          [wpv-view name="instruct-student-get-student-progress" users="[types field='student-11' output='raw'][/types]"]
          [wpv-view name="instruct-student-get-student-progress" users="[types field='student-12' output='raw'][/types]"]
          [wpv-view name="instruct-student-get-student-progress" users="[types field='student-13' output='raw'][/types]"]
          [wpv-view name="instruct-student-get-student-progress" users="[types field='student-14' output='raw'][/types]"]
          [wpv-view name="instruct-student-get-student-progress" users="[types field='student-15' output='raw'][/types]"]
          [wpv-view name="instruct-student-get-student-progress" users="[types field='student-16' output='raw'][/types]"]
          [wpv-view name="instruct-student-get-student-progress" users="[types field='student-17' output='raw'][/types]"]
          [wpv-view name="instruct-student-get-student-progress" users="[types field='student-18' output='raw'][/types]"]
          [wpv-view name="instruct-student-get-student-progress" users="[types field='student-19' output='raw'][/types]"]
          [wpv-view name="instruct-student-get-student-progress" users="[types field='student-20' output='raw'][/types]"]
          [wpv-view name="instruct-student-get-student-progress" users="[types field='student-21' output='raw'][/types]"]
          [wpv-view name="instruct-student-get-student-progress" users="[types field='student-22' output='raw'][/types]"]
          [wpv-view name="instruct-student-get-student-progress" users="[types field='student-23' output='raw'][/types]"]
          [wpv-view name="instruct-student-get-student-progress" users="[types field='student-24' output='raw'][/types]"]
          [wpv-view name="instruct-student-get-student-progress" users="[types field='student-25' output='raw'][/types]"] 
          <hr />[gap size="25px"]
          [/wpv-conditional]   

          [wpv-conditional if="( '[types field='course-level' output='raw'][/types]' eq '5' )"]<h3>Course: Anatomy for TT Level 300 (15 hours)</h3>
          <strong>Instructor: [wpv-user field="user_firstname"] [wpv-user field="user_lastname"]</strong><br /> Following is a list of your enrolled students with the course name and progress:<br /><br />  
          [wpv-view name="instruct-student-get-student-progress" users="[types field='student-1' output='raw'][/types]"]
          [wpv-view name="instruct-student-get-student-progress" users="[types field='student-2' output='raw'][/types]"]
          [wpv-view name="instruct-student-get-student-progress" users="[types field='student-3' output='raw'][/types]"]
          [wpv-view name="instruct-student-get-student-progress" users="[types field='student-4' output='raw'][/types]"]
          [wpv-view name="instruct-student-get-student-progress" users="[types field='student-5' output='raw'][/types]"]
          [wpv-view name="instruct-student-get-student-progress" users="[types field='student-6' output='raw'][/types]"]
          [wpv-view name="instruct-student-get-student-progress" users="[types field='student-7' output='raw'][/types]"]
          [wpv-view name="instruct-student-get-student-progress" users="[types field='student-8' output='raw'][/types]"]
          [wpv-view name="instruct-student-get-student-progress" users="[types field='student-9' output='raw'][/types]"]
          [wpv-view name="instruct-student-get-student-progress" users="[types field='student-10' output='raw'][/types]"]
          [wpv-view name="instruct-student-get-student-progress" users="[types field='student-11' output='raw'][/types]"]
          [wpv-view name="instruct-student-get-student-progress" users="[types field='student-12' output='raw'][/types]"]
          [wpv-view name="instruct-student-get-student-progress" users="[types field='student-13' output='raw'][/types]"]
          [wpv-view name="instruct-student-get-student-progress" users="[types field='student-14' output='raw'][/types]"]
          [wpv-view name="instruct-student-get-student-progress" users="[types field='student-15' output='raw'][/types]"]
          [wpv-view name="instruct-student-get-student-progress" users="[types field='student-16' output='raw'][/types]"]
          [wpv-view name="instruct-student-get-student-progress" users="[types field='student-17' output='raw'][/types]"]
          [wpv-view name="instruct-student-get-student-progress" users="[types field='student-18' output='raw'][/types]"]
          [wpv-view name="instruct-student-get-student-progress" users="[types field='student-19' output='raw'][/types]"]
          [wpv-view name="instruct-student-get-student-progress" users="[types field='student-20' output='raw'][/types]"]
          [wpv-view name="instruct-student-get-student-progress" users="[types field='student-21' output='raw'][/types]"]
          [wpv-view name="instruct-student-get-student-progress" users="[types field='student-22' output='raw'][/types]"]
          [wpv-view name="instruct-student-get-student-progress" users="[types field='student-23' output='raw'][/types]"]
          [wpv-view name="instruct-student-get-student-progress" users="[types field='student-24' output='raw'][/types]"]
          [wpv-view name="instruct-student-get-student-progress" users="[types field='student-25' output='raw'][/types]"]
          <hr />
          [/wpv-conditional]       
          
[/wpv-conditional] 
		</wpv-loop>
	<!-- wpv-loop-end -->
	[/wpv-items-found]
	[wpv-no-items-found]
		<strong>[wpml-string context="wpv-views"]<!-- No items found -->[/wpml-string]</strong>
	[/wpv-no-items-found]
[wpv-layout-end]

#1254753

Luo Yang
Supporter

Languages: English (English ) Chinese (Simplified) (简体中文 )

Timezone: Asia/Hong_Kong (GMT+08:00)

Hello,

I suggest you use content template instead of nested wpv-conditional shortcodes, for example:
1) Create two content templates, for example:
a) Content template "course-level-3", with below codes:

[wpv-conditional if="( '[types field='course-level' output='raw'][/types]' eq '3' )"]
<h3>Course: Anatomy for TT Level 200 (20 hours)</h3>
...
[/wpv-conditional]

b) Content template "course-level-5", with below codes:

[wpv-conditional if="( '[types field='course-level' output='raw'][/types]' eq '5' )"]
<h3>Course: Anatomy for TT Level 300 (15 hours)</h3>
...
[/wpv-conditional] 

2) Use above content templates shortcode insider View's loop, for example:

...
        <wpv-loop>           
[wpv-conditional if="( '[lowercase string='[wpv-current-user info='login']']' eq '[lowercase string='[wpv-post-title output='raw']']' )" ] 
          [wpv-post-body view_template="course-level-3"]   
 
          [wpv-post-body view_template="course-level-5"]       
           
[/wpv-conditional] 
        </wpv-loop>
...