0

I'm new in php:

$link = bloginfo("stylesheet_directory");

'before_title' => 

'<h3 class="widget"><img class="image-left" src="(HERE VARIABLE) + /images/svg/custom-header-left.svg">'

The quick question - how put $link variable to this image src and add to it /images/svg/custom-header-left.svg

2 Answers 2

3

Easy, close the string and concatenate using the string concatenation operator ..

$link = bloginfo("stylesheet_directory");

'before_title' => 

'<h3 class="widget"><img class="image-left" src="' . $link . '/images/svg/custom-header-left.svg">'
Sign up to request clarification or add additional context in comments.

1 Comment

ok my problem was using $link = bloginfo() and not $link = get_bloginfo() ... but this was right answer. Thanks
1

You can concatenate with .:

'<h3 class="widget"><img class="image-left" src="' . $link . '/images/svg/custom-header-left.svg">'

Or you could declare your string with double quotes " and just interpolate $link:

"<h3 class=\"widget\"><img class=\"image-left\" src=\"$link/images/svg/custom-header-left.svg\">"

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.