Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Create an image folder inside wordpress child theme

Tags:

wordpress

I have already set up a child theme. Is it possible to add via FTP on my server a folder (preferably into the same child theme folder) called img and then link to the images in that folder from my pages and posts?

I tried using this path:

<img src="../wp-content/themes/theme-child/img/placeholder.png"/>

but that did not work.

like image 606
Nick Avatar asked Jan 22 '26 10:01

Nick


1 Answers

You need to use the stylesheet directory instead. With a child theme, if you use the template directory it will go to the parent (see explanation on http://codex.wordpress.org/Function_Reference/get_stylesheet_directory_uri).

It should be <img src="<?php echo get_stylesheet_directory_uri(); ?>/img/placeholder.png" />

like image 185
Aibrean Avatar answered Jan 26 '26 22:01

Aibrean



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!