Archived topic
Define ‘data-hero-candidate’ attribute
7 replies · Started by Jayanta on July 6, 2021
Hi,
I having some trouble with the ‘data-hero-candidate’ attribute in my homepage’s images. In the mobile version (responsive) of the website’s homepage, the main image is not having the ‘data-hero-candidate’ attribute. Thus, LCP stats for mobile is not good. The desktop version is perfect and gives a 99 score on Google Pagespeed Insights.
Can you let me know how to add the ‘data-hero-candidate’ attribute to the main image in the mobile version? I am using WP Show Posts to generate the section.
The website is: https://bit.ly/3hXwc5l
Hi there,
Can you explain a bit more which is adding the mentioned attribute? So we'll have an idea which way to point you to.
Can you confirm if the link is correct? It's not working on my end. Let us know. Thanks.
Hi Elvin,
Thanks for your reply.
For better LCP, I want to put the ‘data-hero-candidate’ attribute in the first article’s featured image on the homepage. The featured image of the first article does not have the ‘data-hero-candidate’ attribute now. I want to add that.
If you check the logo, the ‘data-hero-candidate’ attribute is there. I want to add the same attribute to the above-mentioned featured image as well.
How can I add that?
I am told there can be a filter which will add the attribute to the image.
The website is https://thenewsmill.com
Hi there,
this is a topic for WP Show Posts forum. Would you mind raising it there.
Hi,
Raised the issue with WP Show posts. It's been one week now, no response.
Hi there,
Hi,
Raised the issue with WP Show posts. It’s been one week now, no response.
Can you link us to the topic posted WPSP? Some topics got lost in the past week, perhaps it's one of them.
We apologize for this.
Hi,
Here is the link - https://wordpress.org/support/topic/define-data-hero-candidate-attribute/
Hi there,
My apologies for the late response. Please see my answer to the posted topic. :D