Changing ALT-tag for logo in wordpress

I've been working on a site for someone and I've been debating whether or not to take a risk with something. I haven't really worked a lot with .php in the past, but I know that a few mistakes in there can screw a lot of things up massively. I want to change the alt-tag for the logo that's displayed and usually they just had a normal alt-tag in the past. Now I've come across a .php-file which has ".$site_title." as an alt-tag and I don't want to screw anything up on his live website. Is it possible for me to change that part into something else without any problems, or will it screw something up massively if it isn't something specific? Might seem like a big noob-problem, but my past projects haven't really brought me close towards .php and I'd better be safe than sorry.

If it helps: the theme that's used is "Flatsome", so the alt-tag is inside the "element-logo.php". And if anything else is needed, I'll happily provide it.

Thanks in advance!

Topic headers php Wordpress

Category Web


Use the following code to replace the original code:

if(!get_theme_mod('site_logo_dark')) echo '<img width="'.$logo_width.'" height="'.$logo_height.'" src="'.flatsome_option('site_logo').'" class="header-logo-dark" alt="your alt information here" />';

i.e. you're replacing alt="'.$site_title.'" with alt="your alt information here".

What the '.$site_title.' means is the echo statement ends at the ' and then the PHP variable $site_title is appended to the string, and then the string reopens with the '. The . is a string concatenation character in PHP.

About

Geeks Mental is a community that publishes articles and tutorials about Web, Android, Data Science, new techniques and Linux security.