No header.php
I put for example
<img src="wp-content/themes/meu_tema/asserts/imagens/logo.png" title=" />
On the homepage it works, but on the inside it does not work.
How to get around this?
No header.php
I put for example
<img src="wp-content/themes/meu_tema/asserts/imagens/logo.png" title=" />
On the homepage it works, but on the inside it does not work.
How to get around this?
You're using a relative URL, so when you leave the homepage, wp-content/themes/meu_tema/asserts/imagens/logo.png
is being added to the URL of the page you're on, so it does not work.
The quick (and dirty) way to resolve is to add /
to the beginning of the URL:
<img src="/wp-content/themes/meu_tema/asserts/imagens/logo.png" title=" />
The most correct way is to use get_template_directory_uri()
or get_stylesheet_directory_uri()
, like this:
<img src="<?php echo esc_url( get_template_directory_uri(). '/asserts/imagens/logo.png' ); ?>" title="" />
<img src="<?php echo esc_url( get_stylesheet_directory_uri(). '/asserts/imagens/logo.png' ); ?>" title="" />