• Resolved Kyle Numann

    (@kyle-numann)


    I have run into an interesting roadblock. This is my first experience with WordPress (so far, very fantastic) but I am styling my header, and trying to add some social media icons, but no images will appear.

    I have my header.php, index.php, footer.php, style.css & functions.php files in my theme folder, and an images folder with the .png images I am trying to code into the header.

    Is there some basic aspect of wordpress that I need to enable images?
    I have a background image working just fine via a css style.

    I have the social media items in an
    <ul> though I tried coding them outside of the list to see if that was interfering and still no image luck.

    Any ideas?
    Thanks

Viewing 8 replies - 1 through 8 (of 8 total)
  • Your images folder should be inside your theme’s folder.

    Thread Starter Kyle Numann

    (@kyle-numann)

    Thanks for the reply esmi.

    Yes, the images folder is inside of the theme folder, just as twentyten & twentyeleven are.

    I have done a good amount of webdesign (though it’s been a while) so I understand most of the concepts. It should be a simple img src=”images/facebook.png” tag but for some reason it just refuses to show…

    I would link to the example but I am working locally.

    Is there some kind of link issue when a .php page is called from inside another .php page? My index.php loads the header.php which has the image links, but both .php files are in the same directory as the image folder.

    You cannot use relative urls in markup within WordPress. Stick to absolute urls.

    Thread Starter Kyle Numann

    (@kyle-numann)

    ahh okay… that sure did it… though now I have a new problem.
    Now my code is
    img src=”http://localhost/Joby WordPress/wp-content/themes/Origional stripped/images/twitter.png”
    which will obviously break as soon as the site is uploaded…
    How do I work around that?
    Do I have to use the dashboard somehow to include images in my theme?

    Thanks again for your help.

    Thread Starter Kyle Numann

    (@kyle-numann)

    update- since then I searched for some “relative url” topics and seem to have found the people that were looking for the same solution I was looking for. And what do you know, esmi was there posting helpful information…

    thanks for sending me in the right direction.

    You need to use WP functions to replace urls such as the site url or the url for the template directory.

    <img src="<?php echo get_stylesheet_directory_uri();?>/images/twitter.png alt="Twitter" />

    I’d also suggest that you get that space out of your theme’s folder name. Use a hyphen instead.

    Thread Starter Kyle Numann

    (@kyle-numann)

    Fantastic. This had me held up for far too long, and I never would have guessed the relative URL’s.
    Also, I’m new to this php wizardry… can’t wait to become a little more adept.

    Your advice worked like a charm, thanks again.

    No problem 🙂

Viewing 8 replies - 1 through 8 (of 8 total)
  • The topic ‘I'm New Here.. Image Problem’ is closed to new replies.