• Resolved Deftwun

    (@deftwun)


    So I’m still pretty new to all this but I’m trying to create a basic child theme that puts a logo in the header. I’m using WAMP as a local server so I have my theme folder created in “C:\wamp\www\wordpress\wp-content\themes”.

    The problem is when I put the image in that folder and point my image element in my header file (copy of the parent header file) to the images location in my theme folder, the image appears as an empty box in the browser. When I copy the path of the image into my search bar I get “about:blank”.

    I’ve opened chromes version of “firebug” and it shows that the path is indeed being interpreted correctly.

    However, If I set the path to just “someimage.png” with no directory and put the image itself in the wordpress folder (ie “C:\wamp\www\wordpress”) it appears in the browser fine. It only seems to be when it is in my themes folder that I have an issue.

    Whats up with that?

    Thanks!

Viewing 3 replies - 1 through 3 (of 3 total)
  • Thread Starter Deftwun

    (@deftwun)

    Just to clarify…

    When I put an image in my theme directory and link to it.. I get an empty image.

    When I put the same image in the root wordpress directory and link to it… it works just fine

    Thread Starter Deftwun

    (@deftwun)

    I think I’ve found what might be causing it.

    so heres a bit of code that I’m dealing with:

    <?php
        $imgpath = get_stylesheet_directory();
        $imgpath = $imgpath."/logo.png";
        echo $imgpath;
    ?>
    
    <div id="header">
        <img width="800px" height = "300px" src="<?php echo $imgpath ?>";/>
    </div><!--  #header -->

    $imagepath resolves to this:
    C:\wamp\www\wordpress/wp-content/themes/TestTheme/logo.png

    the slashes are backwards after the root directory which seems to cause my image to point to an ‘about:blank’ page.

    I’m still pretty new to web programming so I’m sure that I’m ignorant of something going on here.

    Thanks!

    Thread Starter Deftwun

    (@deftwun)

    aha!

    bloginfo

    so I used ‘bloginfo(‘stylesheet_directory’) instead and got this as the address:

    //localhost/wordpress/wp-content/themes/TestTheme/logo.png

    Heres the code I used:

    <?php echo bloginfo('stylesheet_directory'); ?>/logo.png
    <img width="800px" height = "300px" src="<?php bloginfo('stylesheet_directory');?>/logo.png";/>

    works like a charm. So I dont know what exactly this is for then (deprecated maybe?). If your trying to do what I was you probably shouldn’t use it though lol.

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘"about:blank" for image when in my theme directory’ is closed to new replies.