-
AuthorPosts
-
August 29, 2022 at 5:30 pm #1363085
Hi Guys,
I am working on an Enfold site with a client at the moment.
SEM Rush reports have highlighted that the social share links at the bottom of each blog post do not have alt text and titles.
Is there an easy way to add simply Alt Text and Titles like:title=”Share on Facebook” alt=”Share on Facebook”
Then the same thing for the other social media share links share on linkedin, share on twitter etc.etc.I can see that Aria Data is present and the tooltip data is contained withing a > span. But the actual link does not have a title.
Please see link in private content to clients site
August 30, 2022 at 3:24 am #1363129Hey Thomas,
Thank you for the inquiry.
You can edit the enfold/includes/helper-social-media.php code file and around line 751 you will see the html for the social share links.
$this->html .= " <li class='av-share-link av-social-link-{$key}' >"; $this->html .= "<a {$blank} {$aria_label} href='" . esc_url( $url ) . "' " . av_icon_string( $icon, false ) . " title='' data-avia-related-tooltip='{$name}'>"; $this->html .= "<span class='avia_hidden_link_text'>{$name}</span>"; $this->html .= '</a>'; $this->html .= '</li> ';
The $name variable should contain the text “Share on xx” or “Link to xx”.
Best regards,
IsmaelAugust 30, 2022 at 9:29 am #1363152Hi Ismael,
I have just copied the file from the parent theme to the child theme into the following folder > Includes > helper-social-media.php and it is being ignored.
If I change the title=” and replace it with
title='{$name}’ alt='{$name}’It only seems to work in the parent theme. In the child theme it is ignored.
Can you confirm where in my child theme I should be saving helper-social-media.php?
When added to child theme > includes > helper-social-media.php it is ignored completely.August 31, 2022 at 10:49 am #1363328Hi,
Thank you for the update.
You may need to override the avia_social_share_links class without class_exists condition instead of copying the whole helper-social-media.php file in your child theme. The title attribute is not added by default because of the sharing links’ tooltip, which displays the value of the $name variable.
Best regards,
IsmaelAugust 31, 2022 at 10:55 am #1363330@Ismael
Regarding the tooltip – This is what I thought as well.
The client has flagged an issue in their SEMRush report. To be honest I think this might be a false positive.I’ll see if I can put a function together that overrides the default function so that the title and alt are displayed.
Thanks Ismael
September 1, 2022 at 9:31 am #1363450Hi Jarvis,
You can also use jQuery to dynamically apply the title attribute to the sharing links, copy the value of the data-avia-related-tooltip attribute from the .av-share-link a element. This is probably much more simple than overriding the whole class.
Thank you for your patience.
Best regards,
Ismael -
AuthorPosts
- You must be logged in to reply to this topic.