New template page cannot display images from assets folder

I am making a website. I wanted to have different pages for displaying different content.

I have a custom front-page.php that displays images from assets/img/.jpg.

Then i created new gallery page for displaying up images. To do this :

  • I created a new page called template-gallery.php.
  • Then I added a new page inside wordpress and that new page used template-gallery.php as the template.
  • Then I edited the template-gallery.php and added my html code to display images.
    I have stored the images inside: assets/img/gallery/*.jpg.

But when i open the gallery page it cannot display the images. In chrome i see the error:

Failed to load resource: the server responded with a status of 404.

Do i have to register the new template-gallery.php somewhere?

Please help I am new to using roots and I am not sure if I am following the correct method to create a new custom page and display my content…

Thanks

What are you using in the template file to display the images?

Try:

<img src="<?php echo get_template_directory_uri(); ?>/assets/img/gallery/example.jpg">
2 Likes

Thanks ben… that worked! :smile:

I am trying to display a gallery http://alexkalicki.com/jquery-simple-gallery/