• Hi,

    after spending 3 days with this issue, I’m definitely done with me knowledge. So I really hope somebody can help me out with it.

    The problem: I am using bootstrap 3 and I can’t display any glyphicons.

    What I could find out is that the font files of bootstrap can not be loaded (404 Not Found). But when I test it out of wordpress (I’m using XAMPP), it’s working fine! So I assume there must be something wrong with my theme. I really tried almost everything but nothing helped.

    I would be really glad if someone could take a look at me theme and tell me what’s wrong with it or at least if it works for you. You can download it here.

Viewing 5 replies - 1 through 5 (of 5 total)
  • I’m a bit confused about how your theme works. get_template_directory_uri() doesn’t appear to return the correct path, and yet the stylesheets are being loaded correctly. On my local install, the Glyphicon fonts are being loaded from domain/wordpress/assets/fonts/glyphicons-*, which gives me a 404 error if I visit that page in my browser.

    Thread Starter Sub_Zero

    (@sub_zero)

    Thank you for testing it.
    I have figured out that it’s not really a matter of the fonts. I think it’s more something wrong with the directory. Because I have just created test.css on /assets/fonts/ and also this simple file appears as 404!

    I also created other directories and put that test.css file into them but yet the same 404 error. The test.css only gets loaded when it’s into the directory assets/css/.
    I have no idea why and how I could change that?!

    Edit: I have now moved all those bootstrap fonts to the directory /assets/css/ and added this to my css:

    @font-face{ font-family:'Glyphicons Halflings';src:url(glyphicons-halflings-regular.eot);src:url(glyphicons-halflings-regular.eot?#iefix) format('embedded-opentype'),url(glyphicons-halflings-regular.woff) format('woff'),url(glyphicons-halflings-regular.ttf) format('truetype'),url(glyphicons-halflings-regular.svg#glyphicons_halflingsregular) format('svg')}

    The fonts are now getting loaded normally. It is a solution but I’m still wondering why I can’t put anything into other directories?!

    In lib/rewrites.php, in the function roots_add_rewrites(), I added this line to the array $roots_new_non_wp_rules: 'assets/fonts/(.*)' => THEME_PATH . '/assets/fonts/$1',, which allowed WordPress to read a test stylesheet placed in that directory. Was that an oversight on your part?

    What I think is going wrong is that when you rewrite the URLs, it isn’t playing nice with the relative URLs used in bootstrap.min.css. If you check that file, you’ll see that the Glyphicons are called via ../fonts/glyphicons-halflings-*.

    A new development: I temporarily changed the permissions on my .htaccess file so that your theme could not rewrite it (why do you do that, by the way?). Doing this allowed the Glyphicons to appear correctly, but now the default logo does not show up.

    Thread Starter Sub_Zero

    (@sub_zero)

    Oh wow … you are good! 🙂

    I am not the author of this. It’s just a template so you can build your own theme on it. I don’t know what’s the point of this function. I have just removed everything on that file and now everything works fine! I hope I won’t miss this function in the future because anything won’t work then. I am sure the author had a reason to write it but for now I’m happy without it.

    Anyway, thank you so much for your help. I appreciate it!

Viewing 5 replies - 1 through 5 (of 5 total)

The topic ‘My theme can't load bootstrap fonts’ is closed to new replies.