-
AuthorPosts
-
August 7, 2019 at 2:50 pm #1125551
Hi,
i would like to add an alt tag to the logo and the menue links?
How can i add alt tags to H1, H2, H3 and to Links?
How can i do that?
kind regards Jak
August 7, 2019 at 4:46 pm #1125579for the logo you can put this into child-theme functions.php:
function custom_logo_attriubtes(){ ?> <script> (function($){ $('.logo img').attr({ title:"custom_title", alt:"custom_alt" }); $('.logo img.alternate').attr({ title:"transparent Logo", alt:"Alt Transparent" }); })(jQuery); </script> <?php } add_action('wp_footer', 'custom_logo_attriubtes');
August 7, 2019 at 5:17 pm #1125588for the menu links : maybe you set for all links the content of the menu as alt attribute
this comes as the code above to child-theme functions.php:function set_menu_text_as_alt(){ ?> <script> (function($){ $('#avia-menu .menu-item a').each(function(){ var menuName = $(this).find('>.avia-menu-text').text(); $(this).attr('alt', menuName); }); })(jQuery); </script> <?php } add_action('wp_footer', 'set_menu_text_as_alt');
try first without
$(document).ready(function()
this must work tooAugust 7, 2019 at 5:51 pm #1125606Hi Guenni,
thanks a lot!!!
I will try this.
kind regards Jak
- This reply was modified 5 years, 3 months ago by Jak73. Reason: corrected somthing
August 7, 2019 at 6:07 pm #1125623for the headings you can do it – like the function above and set the content as the alt tag.
But that might be too long.you can use my edited heading.php – if there is a link on the heading there will be an input field for alt attribute:
August 7, 2019 at 6:10 pm #1125625Hi Guenni,
Manny thanks!
Where do i find child-theme functions.php ?kind regards Jak
August 7, 2019 at 6:28 pm #1125649https://kriesi.at/documentation/enfold/child-theme/
On default there is no child-theme present. But you can download a predefined one from link above.
A lot of those snippets here on board only work good with a child-theme.
You can update the parent theme without the risk of lost the made adjustments to the theme.If you are not familiar with child-theme – read that carefully – and read my tutorial on that linked page above carefully too.
August 8, 2019 at 6:27 am #1125766Hi,
Thanks for helping out @guenni007, please let us know if you should need any further help on the topic @jak73.
Best regards,
Rikard -
AuthorPosts
- You must be logged in to reply to this topic.