I'm adding some inline styles to the
file_get_contents(some-style.css) and the
wp_head hook. My relative image paths don't work once they are added to the head, although they do work if I just use
<link> to load the file instead.
The only solution I have to this issue is doing a search and replace on the results of
file_get_contents and add the
template_directory_uri path to it. I would rather not have to do that.
I also tried adding a base url as the theme directory, which solved the issue, but then I create other issues (eg. hashes won't work).
I am also aware of the function
wp_add_inline_style, but that requires another style to have already been loaded, which is what I am trying to avoid.
Is there a better solution to what I am trying to achieve? Or is there a path I can use?