Problem:
Pls advice what are my options now. it seems toolset is generating the srcset . is there any custom code to disable the srcset for certain part ?
this is the code:
[wpv-conditional if="( $(wpcf-property-photo) ne '' )"] <div class="img2"> [types field='property-photo' width='200' height='150' size='thumbnail' align='none' resize='crop'][/types] </div> [/wpv-conditional]
ps: 925.jpg is the img name
this is the output:
<div class="img2"> <img src="https://www.site/media/listings/landed-house/925-200x150.jpg" class="attachment-thumbnail" alt="" style="" title="" srcset="https://www.site/media/listings/landed-house/925-200x150.jpg 200w, https://www.site/media/listings/landed-house/925-400x300.jpg 400w, https://www.site/media/listings/landed-house/925-768x576.jpg 768w, https://www.site/media/listings/landed-house/925.jpg 800w" sizes="(max-width: 200px) 100vw, 200px" width="200" height="150"> </div>
Solution:
In your case, it is a custom image field, so you can display the image URL directly, for example:
[wpv-conditional if="( $(wpcf-property-photo) ne '' )"] <div class="img2"> [wpv-for-each field="wpcf-property-photo"] <img src="[types field='property-photo' width='200' height='150' size='thumbnail' align='none' resize='crop' url="true"][/types] "> [/wpv-for-each] </div> [/wpv-conditional]
Relevant Documentation:
https://toolset.com/documentation/user-guides/views-shortcodes/#wpv-for-each
Iterate through multiple items in a post meta field and output the enclosed text for each item. Including Types repeating fields.
https://toolset.com/documentation/customizing-sites-using-php/functions/#image
url:
'false'(default) | 'true'
true=output the url of the image instead of the html img tag.
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 |
---|---|---|---|---|---|---|
- | 9:00 – 13:00 | 9:00 – 13:00 | 9:00 – 13:00 | 9:00 – 13:00 | 9: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/Hong_Kong (GMT+08:00)
This topic contains 7 replies, has 2 voices.
Last updated by 6 years, 8 months ago.
Assisted by: Luo Yang.