Support » Fixing WordPress » Permalinks and CSS

  • Resolved mtibbits

    (@mtibbits)


    I am having an issue where my CSS file for my theme is not loaded when using Permalinks.

    When I change back to the default Permalink structure all pages work fine.

    This IS when I’m working with Pages and NOT posts.

    I created a custom Permalink and used /%pagename%. This works for first level pages. Ex. website.com/about-us.

    However, if I have a 2nd level page that is a child of the first, it again shows the page, without any CSS formatting. Ex. website.com/about-us/annual-report.

    Can anybody help with this at all? I have a bit of a complicated navigation system for this site, and this will be much easier with Permalinks instead of using the page IDs.

    Thanks,

    Matt

Viewing 5 replies - 1 through 5 (of 5 total)
  • sounds like you’re using relative paths to call in your CSS files. That won’t work. Of course, guessing what the issue is doesn’t help much either. it would help a lot more if you’d provide a link to the site in question.

    Thread Starter mtibbits

    (@mtibbits)

    I am using relative paths…can I not do this?

    I have everything on a local testing server for now so I don’t have a link to the site. If need be I will upload later this evening.

    >>I am using relative paths…can I not do this? <<

    if you do, this is what will happen.

    You forget that WordPress is a system that uses includes to call things in from different areas. If you have it working with a relative path on one page, then when you go another level down, it won’t work anymore – because the relative path you’re using doesn’t change. I.e. “../images” won’t change to “../../images” just because you go in a level deeper. Your header in an included file – it’s the same across ALL pages.

    So no, don’t do that. Use the full path:

    <?php bloginfo('template_directory'); ?>/rest of the path here

    If it’s just to your stylesheet, you should have the stylesheet path in there:

    <?php bloginfo('stylesheet_url'); ?>

    Thread Starter mtibbits

    (@mtibbits)

    Ok, I used:

    <?php bloginfo('stylesheet_url'); ?>

    for my default stylesheet and it is working. One last question is: how do I then link to my print and my IE only stylesheets? They are in the same location, but have a different name than the default style sheet.

    Thread Starter mtibbits

    (@mtibbits)

    Sorry, I guess you already answered that with:

    <?php bloginfo('template_directory'); ?>/rest of the path here

    Thank you very much for your help!

    Matt

Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘Permalinks and CSS’ is closed to new replies.