Skip to content
View in the app

A better way to browse. Learn more.

Web Designer Forum

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

Weird wordpress bug... or?

Featured Replies

Hey,

 

This is really confusing me.

I want to add an image into a page as a link, just as ive done before.

 

So I create the image, transfer it to the images folder. I open up my page and insert:

 

<a href="http://elliothesp.co.uk"><img src="images/photomanip.png" alt="Photo Manipulation" border="0"/></a>

 

However this only shows me the alt text.

 

I then go and insert a line of text from the header which displays an image as a link. And this works.

 

Its like wordpress wont load any new images I put in the folder? :/

As Andy has said its most likely down to the bowser not being able to find the image. Normally its best to put a full location link into the src, if you aren't keeping your images in the themes folder, like this:

 

<img src="http://yourdomain.co.uk/images/image.jpg" alt="" />

 

This is because depending on your structure the browser might not know where the image is if you just have it as images/image.jpg. For example you're on an about page so it will look for the image in yourdomain.co.uk/about/images/image.jpg or if your in a sub page of about then it would look for it in yourdomain.co.uk/about/subpage/images/image.jpg

 

 

If you have the image in your themes folder you can add a bit of php into your image tag so that it knows to look there like so:

 

<img src="<?php bloginfo('template_directory'); ?>/images/image.jpg" alt="" />

  • Author

Ahh okay nice one, just it is reallyyy confusing how wordpress works sometimes.

 

Are there any disadvantages to using direct links though?

well if you want to use your theme on a different domain it means having to go through the code and changing all the links to that domain name.

 

Really if any image needs to be hard coded into the theme I usually place them into an image folder within the theme itself. As it is part of the theme so to me it makes sense to have it with the rest of the files. Then if you decided you wanted to change the design everything is in one place as a back up rather than all over the place and you can build a new theme in a new folder without having to overwrite the old design files.

 

 

I'm not really sure if there would be any other disadvantages though.

Ahh okay nice one, just it is reallyyy confusing how wordpress works sometimes.

 

Are there any disadvantages to using direct links though?

 

Yes, not all servers allow linking direct to an image (hot linking) and if you move the wordpress install to a new domain then you would need to change all the image links.

 

It's a good idea to get into using wordpress functions rather than absolute urls as it makes it much more likely there will be no issues in the future..

Yes, not all servers allow linking direct to an image (hot linking)

 

Really? I always thought that exception rules were put in place for hotlinking, so if you are direct linking to an image you're hosting on your own domain then it would still show if you direct linked. As doesn't the browser still have to look in yourdomain.com/images/image.jpg to find and display the image, and writing it as images/image.jpg is just a shorthand way of coding that?

 

Sorry if I'm wrong about this, I have just always thought that hotlinking scripts were placed to stop other domains direct linking and stealing bandwidth, not to stop the actual domain itself from viewing its own images.

Edited by Dizi

Really? I always thought that exception rules were put in place for hotlinking, so if you are direct linking to an image you're hosting on your own domain then it would still show if you direct linked. As doesn't the browser still have to look in yourdomain.com/images/image.jpg to find and display the image, and writing it as images/image.jpg is just a shorthand way of coding that?

 

Sorry if I'm wrong about this, I have just always thought that hotlinking scripts were placed to stop other domains direct linking and stealing bandwidth, not to stop the actual domain itself from viewing its own images.

 

You maybe right Dizi, I meant absolute urls e.g. http://www.domain.co.uk/images/image_set/image1.jpg.

 

You maybe right about the server allowing them, not something I have checked myself.

Create an account or sign in to comment

Account

Navigation

Search

Search

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.