How display img in index.php

I have themplate it works fine no problem.

when I try to convert the themplate to theme wordpress, I copy all the content to index.php theme inside the the content I got the below code:

<ul>
                                <li>
                                    <div class="box-1">
                                        <img src="images/page1-img1.jpg" alt="" /> <a href="#">bora-bora</a>
 <span>from $458</span> 
                                        <p>Praesent vestibulum aenean
                                            <br>nonummy hendrerit mauris.</p>
                                    </div>
                                </li>
                                <li>
                                    <div class="box-1">
                                        <img src="images/page1-img2.jpg" alt="" /> <a href="#">Hawaii</a>
 <span>from $458</span> 
                                        <p>Praesent vestibulum aenean
                                            <br>nonummy hendrerit mauris.</p>
                                    </div>
                                </li>

the images are not display on the screen.

I can see my theme in url:`http://127.0.0.1/www/www1/wordpress/Heb/wordpress/

to see the img I can see with full path:

http://127.0.0.1/www/www1/wordpress/Heb/wordpress/wp-content/themes/yossi_theme/images/page1-img1.jpg

if I click right mouse on the picture wich I can't see, and copy target url,I got the adress:

http://127.0.0.1/www/www1/wordpress/Heb/wordpress/images/slide-1.jpg

and the error :The requested URL /www/www1/wordpress/Heb/wordpress/images/slide-1.jpg was not found on this server.

what should I change here <img src="images/page1-img1.jpg" alt="" /> to display the img ?

many thanks.

Answers


Since you said that the full path of your image is

http://127.0.0.1/www/www1/wordpress/Heb/wordpress/wp-content/themes/yossi_theme/images/page1-img1.jpg

then you can try this

<img src="<?php echo get_template_directory_uri()?>/images/yourImageName.png" alt="" />

instead of

<img src="images/yourImageName.png" alt="" />

get_template_directory_uri() will return your theme folder's path, i.e.

http://127.0.0.1/www/www1/wordpress/Heb/wordpress/wp-content/themes/yossi_theme

Need Your Help

Will int32 be the same size on all platforms?

c++

I'm developing a multi platform app (iOS, Android, etc), using C++.

About UNIX Resources Network

Original, collect and organize Developers related documents, information and materials, contains jQuery, Html, CSS, MySQL, .NET, ASP.NET, SQL, objective-c, iPhone, Ruby on Rails, C, SQL Server, Ruby, Arrays, Regex, ASP.NET MVC, WPF, XML, Ajax, DataBase, and so on.