Support » Plugin: Multiple Domain Mapping on Single Site » Direct stylesheet references to domain

  • Resolved cselin

    (@cselin)


    I am using this plugin and it has been great. I realised that on my redirected domains, the URLs of template elements, eg.
    <link type="text/css" rel="stylesheet" href="<?php bloginfo('stylesheet_url'); ?>">

    still show the URL as the main website, not the redirected site. How do I change this?

Viewing 6 replies - 1 through 6 (of 6 total)
  • Plugin Author matthias.wagner

    (@matthiaswagner)

    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!

    Plugin Author matthias.wagner

    (@matthiaswagner)

    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?

    Plugin Author matthias.wagner

    (@matthiaswagner)

    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 🙂

Viewing 6 replies - 1 through 6 (of 6 total)
  • You must be logged in to reply to this topic.