Skip Navigation

[Resolved] Conditional output not working

This support ticket is created 7 years, 1 month 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
- 10:00 – 13:00 10:00 – 13:00 10:00 – 13:00 10:00 – 13:00 10:00 – 13:00 -
- 14:00 – 18:00 14:00 – 18:00 14:00 – 18:00 14:00 – 18:00 14:00 – 18:00 -

Supporter timezone: Asia/Kolkata (GMT+05:30)

This topic contains 4 replies, has 2 voices.

Last updated by randallH-3 7 years, 1 month ago.

Assisted by: Minesh.

Author
Posts
#576360

Conditional output not working.

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

		<div class="row" style="line-height:1.25; " id="MRBrief">
      
	<wpv-loop>
       <a href="[wpv-post-url]">
         <div class="col-sm-3" id="colBrief1">
           <div id="divTransBrief1">
                   [wpv-conditional if="( $(wpcf-post-category) eq 'Briefing' )"]

				<center>[types field='briefing-featured-image'  style="height:150px; width:300px;"][/types]</center>
			      <br>
              <span style="font-size:15px; font-weight:bold; ">[types field='briefing-title'][/types]</span>
             <div id="div-content-bottom1">
              <p style="font-size:12px;  padding-top:10px; color:black;"><img src="<em><u>hidden link</u></em>" width="25" height="25" style="vertical-align:middle;"/>[types field='briefing-publication-date'][/types]&nbsp;&nbsp;&nbsp;&nbsp;<img src="<em><u>hidden link</u></em>" width="25" height="25" style="vertical-align:middle;"/>[wpv-post-field name='epicredvote']&nbsp;&nbsp;&nbsp;&nbsp;<img src="<em><u>hidden link</u></em>" width="25" height="25" style="vertical-align:middle; "/>[wpv-post-comments-number none='0' one='1' more='%']&nbsp;&nbsp;&nbsp;&nbsp;</p></div>
            [/wpv-conditional]
             
             [wpv-conditional if="( $(wpcf-post-category) eq 'Proof Point' )"]
                         
             
				<center>[types field='proof-point-chart-image' style="height:150px; width:300px;"][/types]</center>
			      <br>
              <span style="font-size:15px; font-weight:bold; ">[types field='proof-point-title'][/types]</span>
             <div id="div-content-bottom1">
              <p style="font-size:12px;  padding-top:10px; color:black;"><img src="<em><u>hidden link</u></em>" width="25" height="25" style="vertical-align:middle;"/>[types field='briefing-publication-date'][/types]&nbsp;&nbsp;&nbsp;&nbsp;<img src="<em><u>hidden link</u></em>" width="25" height="25" style="vertical-align:middle;"/>[wpv-post-field name='epicredvote']&nbsp;&nbsp;&nbsp;&nbsp;<img src="<em><u>hidden link</u></em>" width="25" height="25" style="vertical-align:middle; "/>[wpv-post-comments-number none='0' one='1' more='%']&nbsp;&nbsp;&nbsp;&nbsp;</p></div>
             [/wpv-conditional]


         </div>
         </div>
      </a>
	</wpv-loop>

  
</div>

	<!-- 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]

#576370

Minesh
Supporter

Languages: English (English )

Timezone: Asia/Kolkata (GMT+05:30)

Hello. Thank you for contacting the Toolset support.

Well - to check the taxonomy term conditionally you need to use has_term() function inside [wpv-conditional] shortcode.

To check if a post has a specific term assigned we will use the WordPress core function called has_term. Before a WordPress core function can be used by Views, you must first register it.- You can register has_term() function at:

=> Toolset => Settings => Front-end Content tab => Functions inside conditional evaluations 

For example:

[wpv-conditional if="( has_term('your-term-slug', 'category',null) eq '1' )" ]
      your content goes here
 [/wpv-conditional]

More info:
=> https://toolset.com/documentation/user-guides/conditional-html-output-in-views/displaying-taxonomies-conditionally/

#577163

This is not taxonomy.

#577174

Minesh
Supporter

Languages: English (English )

Timezone: Asia/Kolkata (GMT+05:30)

ahh - then I need to check why its not working.

Can I have problem URL and temporary access details.

*** Please make a FULL BACKUP of your database and website.***
I would also eventually need to request temporary access (WP-Admin and FTP) to your site. Preferably to a test site where the problem has been replicated if possible in order to be of better help and check if some configurations might need to be changed.

I would additionally need your permission to de- and re-activate Plugins and the Theme, and to change configurations on the site. This is also a reason the backup is really important. If you agree to this, please use the form fields I have enabled below to provide temporary access details (wp-admin and FTP).

I have set the next reply to private which means only you and I have access to it.

#578883

Fixed the issue.