WordPress.org

Ready to get started?Download WordPress

Forums

[resolved] Permalinks breaking my theme (or other way round) (3 posts)

  1. pafell
    Member
    Posted 1 year ago #

    Hello!

    I have been creating a custom WordPress theme lately and all was well: theme was working on my local XAMPP environment as well as on online WordPress installation that I have set up to ask friends about their opinions.

    Problems showed up when I moved the theme to my actual blog - although I could view all the posts while using index.php, all the formatting seemed to be gone when I navigated to a post or page (single.php & page.php, see screenshots). After some tweaking, I figured out that problem (probably) lies with permalinks. On my main blog, I have custom permalink structure:

    /wpis/%year%/%monthnum%/%postname%/

    On both of my testing blogs I was using default permalinks as I didn't care about it really. Once I changed permalink structure on localhost and online testing installation to other than default, I had the same issues there.

    So basically, my single.php and page.php pages do not work properly if permalinks structure is not set to default.

    Screenshot of working single.php
    Screenshot of faulty single.php

    My header.php
    index.php
    single.php
    page.php
    sidebar.php
    footer.php
    functions.php
    comments.php
    .htaccess

    My test site is located at houston.pawelglaz.pl

    Note: my theme successfully passes W3C HTML5 validation test.

    Anyone might suggest a fix for this?

  2. esmi
    Theme Diva & Forum Moderator
    Posted 1 year ago #

    You need to amend the link to the stylesheets in header.php so that they all point to the current theme's folder. See http://codex.wordpress.org/Function_Reference/get_stylesheet_directory

  3. pafell
    Member
    Posted 1 year ago #

    Ah, it was that simple...

    I have been storing theme's stylesheets in the root (apart from an empty style.css in theme's directory) as I was creating two identical themes - one translated into Polish, other into English. It seemed easier to have just a single set of stylesheets.

    Anyway, thanks a lot! Working perfectly now :)

Topic Closed

This topic has been closed to new replies.

About this Topic