Skip Navigation

[Resolved] Adding fields inside options and other fields

This support ticket is created 6 years, 4 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 4 replies, has 2 voices.

Last updated by Ole Andreas Vekve 6 years, 3 months ago.

Assigned support staff: Serhii Salii.

Author
Posts
#421736

Hello,

Trying to add fields inside options and other fields.

I think I have understood it correctly that you don't support if / else, but only if. For me this looks very correct. For both the options and field type.

<p>
[types field="solgt" option="1" state="checked"]<strong>Solgt</strong>[/types]<br />
[types field="solgt" option="1" state="unchecked"]<br />
         kr. [types field='pris'][/types],-<br />
         [types field='kommentar-til-pris'][/types]<br />
[/types]
</p>

However, the browser outputs the following:

<p>
      <br>
      <br>
      	kr. (here comes the field 'pris'),-<br>
        here comes the field 'kommentar-til-pris')<br>
      [/types]
</p>

Yes, [/types] is being displayed on the site.

I am also trying to add if fields, but this outputs nothing.

<p>
[wpv-if field="storrelse-motiv" evaluate="!empty($field)"]<br />
     Motiv: [types field='storrelse-motiv'][/types]<br />
[/wpv-if]
</p>

<p>[wpv-if field="storrelse-ramme" evaluate="!empty($field)"]<br />
    Ramme: [types field='storrelse-ramme'][/types]<br />
[/wpv-if]
</p>

Any solutions?

Looking forward to hear from you again,

Sample: hidden link

#421792

Hello,

[wpv-if] shortcode is outdated and replaced with [wpv-conditional] shortcode to display conditional output.

Please take a look at Views conditional output Doc: https://toolset.com/documentation/user-guides/conditional-html-output-in-views/

In your case you can use this snippet:

[wpv-conditional if="$(wpcf-solgt) eq 'checked'"]
    What will be done if the expression is true
[/wpv-conditional]
#421825

Thank you,

Checked / unchecked did not work using the wpv-conditional, so I used 1 instead. However, if it's not checked, nothing happens. I put eq 0, meaning if it was not checked, it should print that instead. Am I right?

<p>
[wpv-conditional if="$(wpcf-solgt) eq '1'"]
      <strong>Solgt</strong><br />
[/wpv-conditional]<br />

[wpv-conditional if="$(wpcf-solgt) eq '0'"]<br />
     kr. [types field='pris'][/types],-<br />
     [types field='kommentar-til-pris'][/types]<br />
[/wpv-conditional]
</p>

Also tried the following

<p>[wpv-conditional if="( $(wpcf-solgt) eq 'checked'" evaluate="true"]
    <strong>Solgt</strong><br />
[/wpv-conditional]<br />

But this did not work either.

Any ideas?

Also tried the following:

[wpv-conditional if="( $(wpcf-solgt) eq 'checked'" evaluate="true"]<strong>Solgt</strong><br />
[/wpv-conditional]
  
[wpv-conditional if="( $(wpcf-solgt) ne '' )"]
  kr. [types field='pris'][/types],-<br />
  [types field='kommentar-til-pris'][/types]<br />
[/wpv-conditional]

Solved by using the following:

[wpv-conditional if="$(wpcf-solgt) eq '1'"]
  <strong>Solgt</strong><br />
[/wpv-conditional]
  
[wpv-conditional if="$(wpcf-solgt) eq '1'" evaluate="false"]
  kr. [types field='pris'][/types],-<br />
  [types field='kommentar-til-pris'][/types]<br />
[/wpv-conditional]
#421848

It's nice to hear, that you had solved your task.

Have a nice day!

#425718

Solved by using the following

[wpv-conditional if="$(wpcf-solgt) eq '1'"]
  <strong>Solgt</strong><br />
[/wpv-conditional]
   
[wpv-conditional if="$(wpcf-solgt) eq '1'" evaluate="false"]
  kr. [types field='pris'][/types],-<br />
  [types field='kommentar-til-pris'][/types]<br />
[/wpv-conditional]