Vanina Yordanova
Vanina Yordanova

Reputation: 89

How to display image in Wordpress theme?

I am trying to display an image in a custom wordpress theme. In the theme folder I have an img folder with all the images. It does not show anything.

  <footer class="container-fluid" style="margin-top: 30px;"> 

            <div class="row">
            <div class="col-md-4"><img src="<?php bloginfo('template_url'); 
           ?>/footer_logo.png"></div>
            </div>

Upvotes: 1

Views: 2844

Answers (2)

Scriptonomy
Scriptonomy

Reputation: 4055

You simply forgot to reference the image folder itself.

<img src="<?php bloginfo('template_url') ?>/img/footer_logo.png">

Upvotes: 1

AddWeb Solution Pvt Ltd
AddWeb Solution Pvt Ltd

Reputation: 21681

You can use get_template_directory_uri() function to get URL of your active theme.

Here is the updated code, by which you can print image from your theme directory:

<footer class="container-fluid" style="margin-top: 30px;"> 

            <div class="row">
            <div class="col-md-4"><img src="<?php echo get_template_directory_uri();?>/[img folder name]/footer_logo.png"></div> 
            </div>
</footer>

Let us know if you need any further help in this.

Thanks!

Upvotes: 3

Related Questions