Forums

The forums ran from 2008-2020 and are now closed and viewable here as an archive.

Home Forums Other WordPress – Broken Images

  • This topic is empty.
Viewing 15 posts - 1 through 15 (of 21 total)
  • Author
    Posts
  • #35384
    tobeeornot
    Member

    I have a number of jpg files within the images folder of my custom themes that are linked to a template. I can’t see what is wrong but the images are appearing broken. I can only imagine I have the file path wrong:

    leads

    Similarly, I am trying to link images dynamically to the custom fields set on the relevant WP back-end page and nothing is appearing. I am using the following code in the relevant template:

     ' />

    I have tried to link this to to the page “images/sales.jpg” in the custom field.

    #91500
    TheDoc
    Member

    Both will be wrong because it’s not linking to your theme’s folder.

    For the first one:

    leads

    For the second, make sure you are linking to the absolute path of the image. The absolute path would be something like:

    http://www.yourwebsite.com/wp-content/themes/yourthemename/images/sales.jpg

    #91501
    tobeeornot
    Member

    @The Doc – thanks for this. For the second one, where I want to link images through custom-fields on the back-end pages, do I not have to use php code as well?

    Or did you just mean the path in that page needed readjusting?

    #91503
    TheDoc
    Member

    Yea, the path needs readjusting. You don’t need to include the domain, but everything after it.

    #91505
    tobeeornot
    Member

    Out of interest, have you ever deleted a page and then created it again with the same title at another point to find the slug has changed to say /about-2/

    Can you ever get it back to its original state?

    #91506
    tobeeornot
    Member

    By the way, is the php code right with the second one, as the link is not working.

    #91507
    TheDoc
    Member

    PHP should not be used in the custom field. The PHP is for the first image that you posted.

    It probably has about-2 because your deleted page is still in the trash and can be restored. Delete it permanently and you should be able to use /about/.

    #91508
    tobeeornot
    Member

    Not in the custom field but the corresponding area in the template.

    #91509
    TheDoc
    Member

    It should be working. Is anything showing at all? Are you running the code within the loop?

    #91513
    tobeeornot
    Member

    No, nothing is showing and it is within the loop.

    #91515
    TheDoc
    Member

    Well something must be showing up in the HTML. If you have the following:

    ' />

    Then the minimum that would show up in the HTML would have to be:

    Is that what you see?

    #91516
    tobeeornot
    Member

    Yes, the

    is what is showing up in the html.

    #91522
    TheDoc
    Member

    Can you take a screenshot of what you see in the custom field area of your post? (the edit screen)

    #91524
    tobeeornot
    Member

    screenshot

    Only the Sales box is relevant. I have also tried without the / in front of wp-content.

    #91530
    TheDoc
    Member

    With or without the slash should work. I don’t know why it’s not working! In case you had any spelling mistakes, try copying what I’ve put below:

    If that doesn’t work, post the entire template where you are trying to use the custom field.

Viewing 15 posts - 1 through 15 (of 21 total)
  • The forum ‘Other’ is closed to new topics and replies.