Ways to call image in wordpress

Asked

Viewed 2,819 times

0

Following

        <div class="site-branding">
              <img src="http://sitedementirinha.com.br/wordpress/wp-content/themes/alizee/images/logo1.png"/>
        </div>

I have this code in a Wordpress theme, and but it does not load the logo.png in neither a browser or mobile device, I already switched the image, a 10 times and had no result if someone can give me another alternative I am grateful.

  • 1

    Can you link to the site? It would be easier to propose a solution...

3 answers

1

There may be a lock on . htaccess or directory permissions.

A tip I love to use in cases like this is:

  1. Upload the image inside Wordpress through the media menu.
  2. Copy the generated url to the loaded image.
  3. Use this link within the theme.

If this doesn’t work then no image will work within your installation as this is how images are inserted in posts, thumbnails, etc.

1

When it comes to wordpress there are things to facilitate this for example this would already call your theme try so

<?php $template_directory = get_template_directory_uri(); ?>
<div class="site-branding">
   <img src="<?php echo $template_directory;?>/images/logo1.png"/>
</div>

0

  1. Check the image path, access the logo link directly in the browser and see if the image opens or not.
  2. See the permissions of the folder where the image is, usually used 644, but in case of testing can put 777 or 755.
  3. There are several dynamic ways to add images in the template, Anderson mentioned one. You can find others in the Wordpress documentation
  4. Check files like .htaccess, he might be doing some redirect wrong (difficult to happen, but will...)
  5. Clear the site and browser cache, especially if using some speed optimization plugin.

Browser other questions tagged

You are not signed in. Login or sign up in order to post.