hy 🙂
you should always use the wp_enqueue_style()
function to enqueue stylesheets in themes or plugins: https://developer.wordpress.org/themes/basics/including-css-javascript/
this way, they will also be included via the mapped domain 🙂
matt
Thread Starter
cselin
(@cselin)
Thank you! I can do this for my stylesheets.
On more item that relates to using the theme url – what if I would like to redirect images that use the same bloginfo function? Eg.
<img src="<?php bloginfo('template_directory'); ?>/img/logo.png">
Is there a clever way to ensure the URLs of these files also use the mapped domain? Thank you for your help so far!
for files from the media library use wp_get_attachment_image()
and for assets inside the theme folder i usually use get_stylesheet_directory_uri()
. both will also be filtered by our plugin 🙂
Thread Starter
cselin
(@cselin)
Thank you for your quick response!
I tried <img src="<?php echo get_stylesheet_directory_uri(); ?>/img/logo.png" alt="<?php bloginfo('name'); ?>">
but it still seems to use the main site domain instead of the mapped domain – is that implementation correct?
hy. yes that’s what i meant 🙂
i see it in one of our pages too, that the original domain is used here. maybe there has been some change again in wordpress. we will notice that in our backlog, but since it is nothing that breaks functionality, we won’t get to that soon :/
i hope you can still use our plugin with some sources coming from your original domain too!
matt
Thread Starter
cselin
(@cselin)
Thanks again for replying so quickly! Glad to know it wasn’t me making an error.
Yes there’s no problem at the moment, though ideally using the mapped domain would be good for all resources. Thanks a lot for your help 🙂