Viewing 8 posts - 1 through 8 (of 8 total)
  • Author
    Posts
  • #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

    #1125579

    for 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');
    #1125588

    for 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 too

    #1125606

    Hi 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
    #1125623

    for 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:

    https://webers-testseite.de/edited-enfold-alb-elements/

    #1125625

    Hi Guenni,

    Manny thanks!
    Where do i find child-theme functions.php ?

    kind regards Jak

    #1125649

    https://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.

    #1125766

    Hi,

    Thanks for helping out @guenni007, please let us know if you should need any further help on the topic @jak73.

    Best regards,
    Rikard

Viewing 8 posts - 1 through 8 (of 8 total)
  • You must be logged in to reply to this topic.