![Check out Enfold](https://kriesi.at/wp-content/themes/kriesi/images/banner-enfold.jpg)
Tagged: alt
-
AuthorPosts
-
January 3, 2019 at 4:37 pm #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?
January 3, 2019 at 5:07 pm #1049647both 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 once – delete 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');
January 3, 2019 at 5:11 pm #1049648ah 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');
January 4, 2019 at 6:58 am #1049841January 10, 2019 at 5:00 pm #1052379Hey all, works fine like that, thanks!
January 11, 2019 at 9:04 am #1052640Hi,
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,
RikardOctober 13, 2020 at 7:33 pm #1252590Hi 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?
-
This reply was modified 3 years, 11 months ago by
Steve Webgecko.
October 16, 2020 at 3:18 pm #1253277Hi 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,
VictoriaNovember 18, 2020 at 4:56 pm #1261315Back 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 ;-)
November 18, 2020 at 5:07 pm #1261321 -
This reply was modified 3 years, 11 months ago by
-
AuthorPosts
- The topic ‘TITLE & ALT for span class="logo" image’ is closed to new replies.