• Resolved gkcpa

    (@gkcpa)


    When someone first visits my custom blog page, they’ll see it according to style definitions in style.css and header.php. When they click on any link, such as the default “Hello World” article title, the page they’ll see won’t include one of the header images. A blank space except for my firm’s name will appear instead. How can I enable display of that image regardless of mouse actions taken on the page? Here’s a link to the site: https://garykrupacpa.com/wordpress.

Viewing 2 replies - 1 through 2 (of 2 total)
  • Looks like you’re using a relative URL for the image:

    ../images/Header-Home.jpg

    So when you’re on https://garykrupacpa.com/wordpress/, that becomes

    https://garykrupacpa.com/images/Header-Home.jpg

    but when you’re on

    https://garykrupacpa.com/wordpress/uncategorized/new-post-test/

    it’s looking for

    https://garykrupacpa.com/wordpress/uncategorized/images/Header-Home.jpg

    which doesn’t exist.

    You should put the image in the theme, and use <?php get_template_directory_uri(); ?> to get the fight folder for the image.

    Thread Starter gkcpa

    (@gkcpa)

    Thank you! The solution you suggested worked brilliantly! I couldn’t get this to work using either <img src=”<?php echo get_template_directory_uri(); ?> or <href=”<?php echo get_template_directory_uri(); ?> (although it worked for the stylesheet linking earlier in the header.php file), but did when I used my original coding <img src=”/wordpress/wp-content/themes/mywebsite/Header-Home.jpg”. Apparently that link substitutes for
    https://garykrupacpa.com/wordpress/uncategorized/images/Header-Home.jpg when someone clicks on a link with their mouse button.

    I plan to use absolute references for my Navbar links. I tried it for one of the links and it worked. You showed me the way there too.

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘How do I change what happens when a link on my blog page is clicked on?’ is closed to new replies.