Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

WordPress From Bootstrap to WordPress Create Bootstrap Styled Theme Templates Adding Widget Areas to the Front Page

Problem with my own svgs to my own theme

I implemented my own theme and it works fine! But the only problem really is i have some svgs.. It's giving sign that the svgs should be there cause there is alt text but the svg doesn't show.. What to do?

Code here: <?php get_header(); ?>

<div class="banner">
    <img class="logo" src="city-logo.svg" alt="City">
    <h1 class="headline">We're making your website or app dream come true</h1>
    <span class="tagline">For a fair price.</span>
</div><!--/.banner-->

and <figure> <img class="icon-location" src="location.svg" alt="Location"> <img class="feat-img" src="treats.svg" alt="Drinks and eats"> <figcaption> <h4>We are now also making JAVA apps!</h4> A web language also used to make google, facebook etc. </figcaption> </figure>

1 Answer

Sue Dough
Sue Dough
35,800 Points

Well first I think you should consider making the svgs inline. Its better for a lot of reasons and also saves http requests. But thats another topic.

The issue is your not calling the right file path I think. Try this it should work assuming you have an SVG folder in your theme where your storing the svgs.

<div class="banner">
    <img class="logo" src="<?php echo get_template_directory() . '/svg/city-logo.svg'; ?>" alt="City">
    <h1 class="headline">We're making your website or app dream come true</h1>
    <span class="tagline">For a fair price.</span>
</div><!--/.banner-->

( untested but should work )