WordPress.org

Ready to get started?Download WordPress

Forums

Properly linking an image from sidebar (3 posts)

  1. SEjack
    Member
    Posted 1 year ago #

    I'm working on building a new site on a server that hasn't had the DNS nameservers pointed to yet. I'm testing/using the admin panel through the IP address.

    I'm trying to add an image to the sidebar. I added a text widget to it and tried:

    - Putting the path dynamically with PHP. This didn't work because this won't process PHP
    - putting the relative path: wp-content/themes/physmed/images/image.jpg, but this only works on the homepage. On other pages and posts the link breaks because it is on a different subfolder.
    - Putting an absolute path. But when my client changes the nameservers, I'll have to go back and change the paths again. Something I don't want to have to explain to the client.

  2. Frank Klein
    Member
    Posted 1 year ago #

    You need to associate the IP of the new website along with its URL in the hosts file on your computer. This will enable you to view the new website over its domain.

    For the image, you should be using the full URL instead of a path. Ideally you would do this via modifying the Theme's sidebar code or via a plugin that takes care of generating the right code.

  3. SEjack
    Member
    Posted 1 year ago #

    Thank you. I used the image widget plugin. It was great

Topic Closed

This topic has been closed to new replies.

About this Topic