• For my themes, I usually define a custom stylesheet uri like so (class based):

    add_filter( 'stylesheet_uri', 'stylesheet_uri', 10, 2 );
    function stylesheet_uri( $stylesheet_uri, $stylesheet_dir_uri ) {
    
    			return $stylesheet_dir_uri . '/css/style.css';
    }

    This seems to be no longer working, as the theme is broken now in the admin screen. WP seems to expect a style.css in the root of the theme folder now.

    However the styles are correctly applied from the file css/style.css

    Can anyone confirm this?

    Thanks, Paddelboot

Viewing 5 replies - 1 through 5 (of 5 total)
  • Andrew Nevins

    (@anevins)

    WCLDN 2018 Contributor | Volunteer support

    What’s inside those two variables and what do you mean by broken?

    Thread Starter paddelboot

    (@paddelboot)

    By broken I mean that the theme gets deactivated as soon as I visit the theme admin.

    Until then it works fine, because as I have added, WP takes the styles from /css/style.css, not from the file in the root of the folder.

    The two vars:

    https://home.ms/wp-content/themes/home/style.css
    
    https://home.ms/wp-content/themes/home

    So WP seems to be ignoring the stylesheet_uri filter when I visit the theme admin, basically.

    Andrew Nevins

    (@anevins)

    WCLDN 2018 Contributor | Volunteer support

    Were you following a codex article on this originally? Maybe it’s changed in the new docs https://developer.www.ads-software.com/reference/hooks/stylesheet_uri/

    Thread Starter paddelboot

    (@paddelboot)

    I am basically doing what this codex article is doing.

    I use a SASS folder structure, so I wanted to remove style.css from the theme root and use a custom stylesheet instead, like /css/style.css

    It seemed to work well until recently.

    Andrew Nevins

    (@anevins)

    WCLDN 2018 Contributor | Volunteer support

    I see, for now can you try adding a style.css file in your root theme directory and just put your CSS comments in there? That should make the dashboard happy, i.e.:

    /*
    Theme Name:   The Theme Name
    Template: the-theme-folder
    */

Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘Custom Stylesheet URI now breaks theme’ is closed to new replies.