Passer la navigation

[Résolu] Alt output and homepage image size

Ce fil est résolu. Voici une description du problème et la solution proposée.

Problem:

I need to confirm if the ALT attribute (alt='%%ALT%%') correctly outputs the ALT text for images in Toolset Views. Additionally, I want to ensure that the featured image displays at the correct size and does not appear larger than necessary in Google Console.

Solution:

The ALT attribute (alt='%%ALT%%') is correctly set if used within a Toolset View. To control the image size, use the size attribute in [wpv-post-featured-image] with predefined values like 'thumbnail', 'medium', 'large', or 'full'. You can also define custom dimensions using size='custom' along with width and height parameters to ensure proper scaling and cropping.

Relevant Documentation:

https://toolset.com/documentation/programmer-reference/views/views-shortcodes/#vf-153425

This support ticket is created Il y a 1 year, 3 months. 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.

Ce sujet contient 1 reply, a 1 voix.

Dernière mise à jour par JorgeE7101 Il y a 1 year, 3 months.

Assisté par: Christopher Amirian.

Auteur
Publications
#2797561

Hello. I have the following code:

<article id="[wpv-post-id]">  
<div class="card">
<em><u>lien caché</u></em>
<div class="card-body">
<div class="post-taxonomy-terms"><div class="d-inline">[wpv-view name="category-term-grid-home" limit="1" orderby="name"]
</div>
</div>
<h2 class="card-title">[wpv-post-link]</h2><em><u>lien caché</u></em>
</div>
</div>
</article>

I have two questions about with this code.

1- Is the alt code correct to output the alt field? (alt=’%%ALT%%’)

2 - How can I make sure the image showing is the correct size and not bigger than it should? Because the intrinsic size in the Google console is always much bigger than the rendered size.

Please make this topic private.

Thanks.

#2797800

Christopher Amirian
Supporter

Les langues: Anglais (English )

Hi,

Welcome to Toolset support. The ALT tag content is added correctly if you are talking in the context of using the code in a view.

Regarding the image size, according to the documentation below the size attribute takes items as below:


'thumbnail' (default) | 'medium' | 'large' | 'full' | 'custom'

https://toolset.com/documentation/programmer-reference/views/views-shortcodes/#vf-153425

So you need to use one of the values above.

Examples:

[wpv-post-featured-image size="medium" raw="false"]
 
[wpv-post-featured-image attr="class=my-custom-class"]
 
[wpv-post-featured-image size='custom' width='300' height='200']
 
[wpv-post-featured-image size='custom' width='300' height='200' crop='true' crop_horizontal='right' crop_vertical='bottom']

Thanks.

#2797858

Thanks Christopher. All solved.