WordPress reach CSS file in Javascript file

I have a script for a demo website that replaces a CSS file with another for different colors. It works perfectly on local, but I couldn’t make it work online.

The part of the code on local that I believe is not working online is :

Read More
if (color == "b9e0e9") {
  switcher_link.attr('href',"http://localhost:8888/wordpress/wp-content/themes/theme1/css/blue-theme.css");
  var atrrHref = switcher_link.attr('href');        
}

I tried to reach the css file with ../css/blue-theme.css and /css/blue-theme.css and css/blue-theme.css also <?php bloginfo('template_directory'); ?>/css/blue-theme.css
What should I write in this case to get the correct path and make the script work online ? I’ve tried pretty much everything that I know but it didn’t work.

Related posts

1 comment

  1. I found it, that was such a simple problem, but also the last thing I could think of.

    The path was ../themes/theme1/css instead of ../themes/Theme1/css .

Comments are closed.