Common practice: Adding images to sage/bower .php files

Very new to Sage, and have a very newbie question.

What is the right way to add images to a .php file?

I have been doing it like so:

dist/images/image-file.png

I first added the image to my assets/images folder through finder then ran gulp and now have it in the dist/images folder.

Its not loading, and I am getting a 404 on the file.
(I have killed gulp watch and restarted while trying to figure this)

You could do something like this

<img  src="<?php bloginfo('template_directory'); ?>/dist/images/image-file.png" alt="your description">

or you could use ACF and replace the above php with something like <?php the_field('field_name');?>

1 Like

Ahh the first example makes sense, great thank you for the super quick reply/post. Very helpful.

I think it’s more common to use get_template_directory_uri(), but yeah, that’s the correct way to do it :slight_smile:

2 Likes