• Hi have a html5 website template which you can download here.

    For some reason when I make the index a .php file and update all the stylesheet and Javascript URLs to have directory included, IE.

    <?php echo get_template_directory_uri(); ?>/css/style.css

    My stylesheet cannot be read. I’v tried placing a stylesheet in the theme root folder and updating the URL to..

    <?php echo get_template_directory_uri(); ?>/style.css

    But still doesnt work. Also when I viewmy chrome console I get an unable to load resource error and it says “GET https://localhost/wordpress/css/style.css 404 (Not Found)”

    Yet I’v searched all the files in all folders and nowhere am I asking to load a resource at /css/style.css.

    Iv been at this for 2 days now, any help would be much appreciated as always.

    Best
    Conor

Viewing 12 replies - 1 through 12 (of 12 total)
  • Conor,

    You can just put the entire path, like that:
    https://www.yourwebsite.com/wp-content/themes/yourtheme/css/style.css&#8217;


    mvieiras

    Andrew Nevins

    (@anevins)

    WCLDN 2018 Contributor | Volunteer support

    What does get_template_directory_uri return for you?

    Thread Starter conor909

    (@conor909)

    mvieriras, thanks for your reply.

    I don’t want to put the entire path because I’m working locally. I have a lot of URLs within the project and would like it to be more dynamic. Besides, I dont see why this shouldnt work.

    Thread Starter conor909

    (@conor909)

    Andrew, it seems get_template_directory_uri is returning:

    href="https://localhost/wordpress/wp-content/themes/helios/style.css"

    Which is what I want, but my console still reads failed to load resource “https://localhost/wordpress/css/style.css&#8221;

    Im still not calling that URL from anywhere in my project, including my Javascript files

    Andrew Nevins

    (@anevins)

    WCLDN 2018 Contributor | Volunteer support

    Are you working in a Child Theme?

    Moderator Jose Castaneda

    (@jcastaneda)

    THEME COFFEE MONKEY

    I have to ask if that is the only file that you are getting the 404 from?

    Thread Starter conor909

    (@conor909)

    Andrew:

    I’m not working in a child theme. Its my first time using a HTML template tho. Usually I use a blank theme and develop from that. For this one, I literally took the template, changed the index to a .php file, and updated the URLs in the <head> to the template directory.

    One problem may be that wordpress needs a style.css in the theme root. I added a style.css to the root, but only included the theme template information. Would this effect my project?

    Jose:

    I am not getting 404 errors for any other file, and my javascript files (linked the exact same way) are being called correctly.

    Here is my <head> code:

    <head>
    <title>Helios by HTML5 UP</title>
    <meta http-equiv="content-type" content="text/html; charset=utf-8" />
    <meta name="description" content="" />
    <meta name="keywords" content="" />
    <link href="https://fonts.googleapis.com/css?family=Source+Sans+Pro:300,400,600" rel="stylesheet" type="text/css" />
    <!--[if lte IE 8]><script src="js/html5shiv.js"></script><![endif]-->
    <script src="<?php echo get_template_directory_uri(); ?>/js/jquery.min.js"></script>
    <script src="<?php echo get_template_directory_uri(); ?>/js/jquery.dropotron.min.js"></script>
    <script src="<?php echo get_template_directory_uri(); ?>/js/skel.min.js"></script>
    <script src="<?php echo get_template_directory_uri(); ?>/js/skel-panels.min.js"></script>
    <script src="<?php echo get_template_directory_uri(); ?>/js/init.js"></script>
    <noscript>
    	<link rel="stylesheet" href="<?php echo get_template_directory_uri(); ?>/css/skel-noscript.css" />
    	<link rel="stylesheet" href="<?php echo get_template_directory_uri(); ?>/style.css" />
    	<link rel="stylesheet" href="<?php echo get_template_directory_uri(); ?>/css/style-desktop.css" />
    	<link rel="stylesheet" href="<?php echo get_template_directory_uri(); ?>/css/style-noscript.css" />
    </noscript>
    <!--[if lte IE 8]><link rel="stylesheet" href="css/ie8.css" /><![endif]-->
    </head>

    Thread Starter conor909

    (@conor909)

    Oh sh!t. Its <noscript> ?

    I had a totally different idea of what <noscript> meant

    The HTML <noscript> Element defines a section of html to be inserted if a script type on the page is unsupported or if scripting is currently turned off in the browser.

    So I’m having the same exact issue… how did you fix it? I tried removing the <noscript> tags and that kinda worked, but it broke the responsive layouts.

    Did somebody fix this problem???… I have something similar.. I would like to make a spanish and an english version of my website.. so.. I added a directory called /en…
    So… in the index.php of this file I put

    <script src="../js/jquery.min.js"></script>
    		<script src="../js/jquery.dropotron.min.js"></script>
    		<script src="../js/skel.min.js"></script>
    		<script src="../js/skel-panels.min.js"></script>
    		<script src="../js/init.js"></script>
    		<noscript>
    			<link rel="stylesheet" href="../css/skel-noscript.css" />
    			<link rel="stylesheet" href="../css/style.css" />
    			<link rel="stylesheet" href="../css/style-desktop.css" />
    			<link rel="stylesheet" href="../css/style-noscript.css" />
    		</noscript>

    but this <noscript> tag doesn’t let the website load the css… when I erase it it works.. but just the desktop version… could somebody help me?

    Oh my gosh! I am having the EXACT same issue!!!! It is driving me crazy…

    What I believe is happening is that within the “init.js”, starting at line 45, the “breakpoints” for some reason are looking for the root of the website and then trying to look for files located in a css folder.

    Although this is good for static files, in WordPress, it needs to point to, for instance, (../wp-content/themes/theme_name/library/css/helios.css).

    There has to be a way to tell the js files to point where you want it to go in WordPress besides automatically pointing to a css folder in the root by default. Any ideas how to go about manipulating this process? Hope this helps!

    Thanks!

    Andrew Nevins

    (@anevins)

    WCLDN 2018 Contributor | Volunteer support

Viewing 12 replies - 1 through 12 (of 12 total)
  • The topic ‘Turning a html5 website template into a theme. Loading unknown resource !?’ is closed to new replies.