I’m trying to develop a WP theme for a client via localhost. I’m using XAMPP on Windows 8 and has set up vhosts to something like myclient.dev.
This works for stylesheet

<?= get_stylesheet_uri(); ?>

But when trying to use get_stylesheet_directory() (Mainly for images) I get the wrong path:
So

<img  class="logo" src="https://wordpress.stackexchange.com/questions/105655/<?= get_stylesheet_directory(); ?>//images/logo.png">

The src returns:

http://myclient.dev/C:/Users/..../Localhost/hfclients.dev/myclient.dev/wp-content/themes/myclient.dev/images/cta-banner.jpg

How can I fix this?

1
1

As I was getting at in comment:

  • get_stylesheet_directory() produces local filesystem path

  • get_stylesheet_directory_uri() produces URL

Just use latter. 🙂

Leave a Reply

Your email address will not be published. Required fields are marked *