WordPress.org

Ready to get started?Download WordPress

Forums

Turning a html5 website template into a theme. Loading unknown resource !? (11 posts)

  1. conor909
    Member
    Posted 7 months ago #

    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 http://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

  2. mvieiras
    Member
    Posted 7 months ago #

    Conor,

    You can just put the entire path, like that:
    'http://www.yourwebsite.com/wp-content/themes/yourtheme/css/style.css'

    -
    mvieiras

  3. Andrew
    Forum Moderator
    Posted 7 months ago #

    What does get_template_directory_uri return for you?

  4. conor909
    Member
    Posted 7 months ago #

    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.

  5. conor909
    Member
    Posted 7 months ago #

    Andrew, it seems get_template_directory_uri is returning:

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

    Which is what I want, but my console still reads failed to load resource "http://localhost/wordpress/css/style.css"

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

  6. Andrew
    Forum Moderator
    Posted 7 months ago #

    Are you working in a Child Theme?

  7. Jose Castaneda
    Member
    Posted 7 months ago #

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

  8. conor909
    Member
    Posted 7 months ago #

    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="http://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>
  9. conor909
    Member
    Posted 7 months ago #

    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.

  10. gabrielle.green
    Member
    Posted 5 months ago #

    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.

  11. cpmariap
    Member
    Posted 3 months ago #

    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?

Reply

You must log in to post.

About this Topic