Answer the question
In order to leave comments, you need to log in
Why is the php request not being interpolated in the image path of the Vue component?
Good afternoon, it seems like a banal problem, but I can’t understand why when I register in the vue component in the template
<img src="<?php echo get_template_directory_uri() ?>/img/icons/icon.svg" alt="icon">
Answer the question
In order to leave comments, you need to log in
Somewhere in the header of the page in the template
<script>
window.tplDir = '<?php echo get_template_directory_uri() ?>';
</script>
<img
:src="window.tplDir + '/img/icons/icon.svg'"
alt="icon"
>
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question