Tagged: 

Viewing 10 posts - 1 through 10 (of 10 total)
  • Author
    Posts
  • #1049635

    Hi

    How can I add TITLE and ALT for the Logo image on top in:

    <span class=”logo”>
    class=”alternate” alt=”” title=””>
    </span>

    “alt” and “title” are empty. Image LOGO in «Media» filled with TITEL, BESCHRIFTUNG and ALTERNATIVTEXT

    any ideas?

    #1049647

    both has to go to the image!
    there was a filter to change the alt attribut for logo but not the title ( this comes to your child-theme functions.php )

    add_filter('avf_logo_alt', 'avf_change_logo_alt');
    function avf_change_logo_alt($alt) {
       $alt = "New Alternate Text Here";
       return $alt;     
    }

    to influence the title attribut too you can do it with jQuery at oncedelete the other code then ( this comes to your child-theme functions.php ):

    function custom_logo_attriubtes(){
    ?>
     <script>
    (function($){
    	$(".logo img").attr("title", "your_custom_title");
    	$(".logo img").attr("alt", "your_custom_alt");
    })(jQuery);
     </script>
    <?php
    }
    add_action('wp_footer', 'custom_logo_attriubtes');
    #1049648

    ah by the way you can do it in one line:

    function custom_logo_attriubtes(){
    ?>
    <script>
    (function($){
    	$('.logo img').attr({ title:"custom_title", alt:"custom_alt" });
    })(jQuery);
    </script>
    <?php
    }
    add_action('wp_footer', 'custom_logo_attriubtes');
    #1049841

    Hi,

    Thanks for helping out @guenni007, did you try that out @klangbildREC?

    Best regards,
    Rikard

    #1052379

    Hey all, works fine like that, thanks!

    #1052640

    Hi,

    Great, glad you got it working. Please let us know if you should need any further help on the topic or if we can close it.

    Best regards,
    Rikard

    #1252590

    Hi there again.

    PHP Snippet doesn’t work now with newer version;

    function custom_logo_attributes(){
    ?>
    <script>
    (function($){
    $(‘.logo img’).attr({ title:”custom_title”, alt:”custom_alt” });
    })(jQuery);
    </script>
    <?php
    }
    add_action(‘wp_footer’, ‘custom_logo_attributes’);

    any ideas how to set TITLE tag for the Image SPAN class «logo» in HEADER?

    #1253277

    Hi Stephan Webgecko,

    It should still work. Maybe there are errors in some other JavaScript?

    Can you give us temporary admin access to your website in the private content box below, so that we can have a closer look?

    Best regards,
    Victoria

    #1261315

    Back again, took some time sorry.

    Yes, you are right, the PHP Snippet «Logo TITLE+ALT tag» works again. I guess some other Secure Plugin (like «Wordfence») blocked the PHP Snippet somehow… I had to «whitelist» this action first ;-)

    #1261321

    Hi,

    Glad you figured it out and thanks for sharing your solution :)

    Regards,
    Yigit

Viewing 10 posts - 1 through 10 (of 10 total)
  • The topic ‘TITLE & ALT for span class="logo" image’ is closed to new replies.