Thread Starter
losiak
(@losiak)
Sorry – of course alt tag 🙂
Once again – picture (in media library) which is logo has correct alt tag – like i want – but Virtue overrides it with the name of the site.
How can I change it.
Hi,
You can set the site identity from Appearance > Customize. Is that what you mean?
Hannah
Thread Starter
losiak
(@losiak)
No, it isn’t . I know how to change site identity 🙂
For example – my site identity is “SiteA” – then logo picture alternative description (alt tag is “SiteA” too.
If i change site identity to “SiteB” – alt tag changes to “SiteB”. But i want something like this: site identity set to “SiteA” and alt tag next to logo set to “SiteB”
This div:
<div id="thelogo">
<img src="http://..../logo.png" alt="SiteA" class="kad-standard-logo" />
</div>
Hey,
The alt tag pulls from the site identity because by default with the logo the site identity other wise doesn’t show. and since thats the logo it uses the site identity name as the alt since that would be the natural alt to the logo.
To override this you would need to edit the theme (I strongly suggest using a child theme). You would edit the templates/header.php file. On line 30 you would edit this: alt="<?php bloginfo('name');?>"
I hope that helps,
Ben
Kadence Themes
Thread Starter
losiak
(@losiak)
Hi,
Thank you. It helps and it works like a charm 🙂
I defined this tag in header.php statically (alt=”SiteB”).
I wonder whether you can set it dynamically (identically as inserting the identity of the site). So tag in header.php is identical to the image tag defined in the media library.
Jac
Sorry for the delay. I’m not following this:
I wonder whether you can set it dynamically (identically as inserting the identity of the site). So tag in header.php is identical to the image tag defined in the media library.
Can you explain more what you mean? the alt by default is going to pull from the site title and you can change the site title in your settings general.
Ben
Kadence Themes
Thread Starter
losiak
(@losiak)
OK,
alt="<?php bloginfo('name');?>"
the alt by default is going to pull from the site title
and when you change the site title the alt is changing, too.
My version – alt=”SiteB” – its statically defined. No matter what is site title the alt is always “SiteB”.
When you put the picture in media library you can assign properties to it. One of them is alt text. So i would like to: choose this picture to be a logo and the alt (of the logo) is pull from picture alt defined early in media library.
Hey,
Sorry not loving the changes to the wordpress forums, not ordered by last response means I miss things like this.
As for your question, sure go for it. If you want to change how the logo works thats fine you can override that line as I said.
Regardless you have to create a child theme and code that out because that isn’t a built in option. But you certainly can add that into your child theme.
You can use the get post meta function. get_post_meta($id, '_wp_attachment_image_alt', true);
Just make sure that you set the id to the id of your image.
Ben
Kadence Themes