user3637351
user3637351

Reputation: 11

Insert logo header.php wordpress

Hello I want to insert my logo to my wordpress site

<img src=”/wordpress/wp-content/themes/test/images/logo.png”>

that is my FTP Path to the image but it's still does not work. When I refresh my site a image icon appears but it does not show my logo... Why? It seem that the PATH don't work right? Any suggestions what could be wrong or is there any special WP Query I need to use? Seems like it? Can't find tho..

Thanks

Upvotes: 0

Views: 6229

Answers (3)

Anju Aravind
Anju Aravind

Reputation: 3362

use something like this

<img src="<?php bloginfo('template_url'); ?>/images/logo.png" />

Upvotes: 0

Praveen Shekhawat
Praveen Shekhawat

Reputation: 360

Use below function for site URL

site_url();

replace this with you img code

<img src="<?php echo site_url("/wp-content/themes/test/images/logo.png"); ?>">

Upvotes: 0

Nathan Dawson
Nathan Dawson

Reputation: 19308

You shouldn't be using an absolute path to an image file. This would be useful if you wanted to get the files attributes in PHP but not when you want to show the image on the page.

There are two functions you should familiarise yourself with:

get_template_directory() - This will get the absolute path to the theme directory. get_template_directory_uri() - This will get the theme directory URI.

Correct way to link to the image file:

<img src="<?php echo get_template_directory_uri(); ?>/images/logo.png">

Don't forget to add an alt attribute.

Upvotes: 1

Related Questions